Comparing version
@@ -10,5 +10,6 @@ "use strict"; | ||
}); | ||
it('ReadStream has constructor property', function () { | ||
it('ReadStream has constructor and prototype property', function () { | ||
var fs = util_1.createFs(); | ||
chai_1.expect(typeof fs.ReadStream.constructor).to.equal('function'); | ||
chai_1.expect(typeof fs.ReadStream.prototype).to.equal('object'); | ||
}); | ||
@@ -15,0 +16,0 @@ it('Can read basic file', function (done) { |
@@ -10,5 +10,6 @@ "use strict"; | ||
}); | ||
it('WriteStream has constructor property', function () { | ||
it('WriteStream has constructor and prototype property', function () { | ||
var fs = util_1.createFs(); | ||
chai_1.expect(typeof fs.WriteStream.constructor).to.equal('function'); | ||
chai_1.expect(typeof fs.WriteStream.prototype).to.equal('object'); | ||
}); | ||
@@ -15,0 +16,0 @@ it('Can write basic file', function (done) { |
@@ -193,2 +193,26 @@ "use strict"; | ||
}); | ||
describe('.reset()', function () { | ||
it('Remove all files', function () { | ||
var vol = new volume_1.Volume; | ||
var json = { | ||
'/hello': 'world', | ||
'/app.js': 'console.log(123)', | ||
}; | ||
vol.fromJSON(json); | ||
vol.reset(); | ||
chai_1.expect(vol.toJSON()).to.eql({}); | ||
}); | ||
it('File operations should work after reset', function () { | ||
var vol = new volume_1.Volume; | ||
var json = { | ||
'/hello': 'world', | ||
}; | ||
vol.fromJSON(json); | ||
vol.reset(); | ||
vol.writeFileSync('/good', 'bye'); | ||
chai_1.expect(vol.toJSON()).to.eql({ | ||
'/good': 'bye', | ||
}); | ||
}); | ||
}); | ||
describe('.openSync(path, flags[, mode])', function () { | ||
@@ -195,0 +219,0 @@ var vol = new volume_1.Volume; |
{ | ||
"name": "memfs", | ||
"version": "2.4.1", | ||
"version": "2.5.0", | ||
"description": "In-memory file-system with Node's fs API.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -40,6 +40,6 @@ # memfs 2.0 | ||
}; | ||
vol.importJSON(json, '/app'); | ||
vol.fromJSON(json, '/app'); | ||
fs.readFileSync('/app/README.md', 'utf8'); // 1 | ||
vol.readFileSync('/app/src/index.js', 'utf8'): // 2 | ||
vol.readFileSync('/app/src/index.js', 'utf8'); // 2 | ||
``` | ||
@@ -177,2 +177,4 @@ | ||
**Note:** To remove all existing files, use `vol.reset()` method. | ||
```js | ||
@@ -201,2 +203,13 @@ vol.fromJSON({ | ||
###### `vol.reset()` | ||
Removes all files from the volume. | ||
```js | ||
vol.fromJSON({'/index.js': '...'}); | ||
vol.toJSON(); // {'/index.js': '...' } | ||
vol.reset(); | ||
vol.toJSON(); // {} | ||
``` | ||
###### `vol.mkdirp(path, callback)` | ||
@@ -203,0 +216,0 @@ |
Sorry, the diff of this file is too big to display
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
197283
0.81%4450
0.79%402
3.34%