Skip to content

Commit

Permalink
Remove src/encodings.js, use Buffer methods instead (#657)
Browse files Browse the repository at this point in the history
  • Loading branch information
humphd authored Jan 3, 2019
1 parent 5f10cc2 commit 26b47ee
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
4 changes: 0 additions & 4 deletions src/encoding.js

This file was deleted.

7 changes: 3 additions & 4 deletions src/filesystem/implementation.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 26b47ee

Please sign in to comment.