bnoordhuis / node-buffertools

working with node.js buffers made easy
ISC License
205 stars 35 forks source link

Buffertools does not work right with buffer from fs #64

Closed unphased closed 9 years ago

unphased commented 9 years ago

Here is a minimal example node script.

#!/usr/bin/env node

var unusedString = "unused string";

var l = console.log;
// var buffertools = require('buffertools');
var fs = require('fs');

fs.readFile(__filename, function(err, data) {
    var x = data.indexOf('unused');
});

Notice that it crashes

You may make it not crash by editing to use buffertools.indexOf.

unphased commented 9 years ago

Dammit. I think you updated the API (Buffer's prototype). That's probably on me for not looking at the changes to the API.