Remove src/encodings.js, use Buffer methods instead (#657)

This commit is contained in:
David Humphrey 2019-01-03 10:46:31 -05:00 committed by GitHub
parent 5f10cc2fde
commit 26b47ee094
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 8 deletions

View File

@ -1,4 +0,0 @@
module.exports = {
encode: string => Buffer.from(string),
decode: buffer => buffer.toString('utf8')
};

View File

@ -29,7 +29,6 @@ var XATTR_REPLACE = Constants.XATTR_REPLACE;
var FS_NOMTIME = Constants.FS_NOMTIME;
var FS_NOCTIME = Constants.FS_NOCTIME;
var Encoding = require('../encoding.js');
var Errors = require('../errors.js');
var DirectoryEntry = require('../directory-entry.js');
var openFiles = require('../open-files.js');
@ -1827,7 +1826,7 @@ function readFile(context, path, options, callback) {
var data;
if(options.encoding === 'utf8') {
data = Encoding.decode(buffer);
data = buffer.toString('utf8');
} else {
data = buffer;
}
@ -1868,7 +1867,7 @@ function writeFile(context, path, data, options, callback) {
data = '' + data;
}
if(typeof data === 'string' && options.encoding === 'utf8') {
data = Encoding.encode(data);
data = Buffer.from(data);
}
open_file(context, path, flags, function(err, fileNode) {
@ -1903,7 +1902,7 @@ function appendFile(context, path, data, options, callback) {
data = '' + data;
}
if(typeof data === 'string' && options.encoding === 'utf8') {
data = Encoding.encode(data);
data = Buffer.from(data);
}
open_file(context, path, flags, function(err, fileNode) {