filer/src/buffer.js

19 lines
479 B
JavaScript
Raw Normal View History

function FilerBuffer (subject, encoding, nonZero) {
// Automatically turn ArrayBuffer into Uint8Array so that underlying
// Buffer code doesn't just throw away and ignore ArrayBuffer data.
if (subject instanceof ArrayBuffer) {
subject = new Uint8Array(subject);
}
return new Buffer(subject, encoding, nonZero);
};
Object.keys(Buffer).forEach(function (p) {
if (Buffer.hasOwnProperty(p)) {
FilerBuffer[p] = Buffer[p];
}
});
module.exports = FilerBuffer;