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

mem-fs-editor

Package Overview
Dependencies
Maintainers
2
Versions
54
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mem-fs-editor - npm Package Compare versions

Comparing version 9.1.0 to 9.2.0

6

lib/actions/commit-file-async.js

@@ -35,3 +35,7 @@ 'use strict';

module.exports = async function (file) {
this.store.add(file);
const existingFile = this.store.get(file.path);
if (!existingFile || existingFile !== file) {
this.store.add(file);
}
if (isFileStateModified(file)) {

@@ -38,0 +42,0 @@ setCommittedFile(file);

18

lib/actions/write.js
'use strict';
const assert = require('assert');
const {setModifiedFileState} = require('../state');
const {isFileStateModified, setModifiedFileState} = require('../state');

@@ -13,8 +13,16 @@ module.exports = function (filepath, contents, stat) {

const file = this.store.get(filepath);
setModifiedFileState(file);
file.contents = Buffer.isBuffer(contents) ? contents : Buffer.from(contents);
file.stat = stat;
this.store.add(file);
const newContents = Buffer.isBuffer(contents) ? contents : Buffer.from(contents);
if (
!isFileStateModified(file)
|| !Buffer.isBuffer(file.contents)
|| !newContents.equals(file.contents)
|| (stat !== undefined && file.stat !== stat)
) {
setModifiedFileState(file);
file.contents = newContents;
file.stat = stat;
this.store.add(file);
}
return file.contents.toString();
};
{
"name": "mem-fs-editor",
"version": "9.1.0",
"version": "9.2.0",
"description": "File edition helpers working on top of mem-fs",

@@ -18,3 +18,3 @@ "scripts": {

"dependencies": {
"binaryextensions": "^4.15.0",
"binaryextensions": "^4.16.0",
"commondir": "^1.0.1",

@@ -27,3 +27,3 @@ "deep-extend": "^0.6.0",

"normalize-path": "^3.0.0",
"textextensions": "^5.12.0"
"textextensions": "^5.13.0"
},

@@ -42,3 +42,3 @@ "peerDependencies": {

"eslint": "^7.26.0",
"eslint-config-xo-space": "^0.28.0",
"eslint-config-xo-space": "^0.29.0",
"jest": "^27.0.6",

@@ -45,0 +45,0 @@ "mem-fs": "^2.2.1",

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