You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

19 lines
507 B

'use strict';
var assert = require('assert');
module.exports = function (filepath, contents, stat) {
assert(
typeof contents === 'string' || contents instanceof Buffer,
'Expected `contents` to be a String or a Buffer'
);
var file = this.store.get(filepath);
file.isNew = file.contents === null;
file.state = 'modified';
file.contents = typeof contents === 'string' ? Buffer.from(contents) : contents;
file.stat = stat;
this.store.add(file);
return file.contents.toString();
};