Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

memfs

Package Overview
Dependencies
Maintainers
1
Versions
154
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

memfs - npm Package Compare versions

Comparing version 2.4.1 to 2.5.0

3

lib/test/volume/ReadStream.test.js

@@ -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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc