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.5.0 to 9.6.0

42

lib/actions/copy.js

@@ -19,26 +19,30 @@ 'use strict';

options = options || {};
const fromGlob = util.globify(from);
let diskFiles = [];
let files = [];
if (options.noGlob) {
const fromFiles = Array.isArray(fromGlob) ? fromGlob : [fromGlob];
diskFiles = fromFiles.filter((filepath) => fs.existsSync(filepath));
const fromFiles = Array.isArray(from) ? from : [from];
files = fromFiles.filter(
(filepath) => this.store.existsInMemory(filepath) || fs.existsSync(filepath)
);
} else {
const fromGlob = util.globify(from);
const globOptions = { ...options.globOptions, nodir: true };
diskFiles = globby.sync(fromGlob, globOptions).map((file) => path.resolve(file));
const diskFiles = globby
.sync(fromGlob, globOptions)
.map((file) => path.resolve(file));
const storeFiles = [];
this.store.each((file) => {
// The store may have a glob path and when we try to copy it will fail because not real file
if (
!diskFiles.includes(file.path) &&
!globby.hasMagic(normalize(file.path)) &&
multimatch([file.path], fromGlob).length !== 0
) {
storeFiles.push(file.path);
}
});
files = diskFiles.concat(storeFiles);
}
const storeFiles = [];
this.store.each((file) => {
// The store may have a glob path and when we try to copy it will fail because not real file
if (
!globby.hasMagic(normalize(file.path)) &&
multimatch([file.path], fromGlob).length !== 0 &&
!diskFiles.includes(file.path)
) {
storeFiles.push(file.path);
}
});
const files = diskFiles.concat(storeFiles);
let generateDestination = () => to;

@@ -56,3 +60,3 @@ if (

const processDestinationPath = options.processDestinationPath || ((path) => path);
const root = util.getCommonPath(from);
const root = options.fromBasePath || util.getCommonPath(from);
generateDestination = (filepath) => {

@@ -59,0 +63,0 @@ const toFile = path.relative(root, filepath);

{
"name": "mem-fs-editor",
"version": "9.5.0",
"version": "9.6.0",
"description": "File edition helpers working on top of mem-fs",

@@ -5,0 +5,0 @@ "scripts": {

@@ -78,3 +78,4 @@ # mem-fs-editor

Copy a file from the `from` path to the `to` path.
Copy file(s) from the `from` path to the `to` path.
When passing array, you should pass `options.fromBasePath` to be used to calculate the `to` relative path. The common directory will be detected and used as `fromBasePath` otherwise.

@@ -81,0 +82,0 @@ Optionally, pass an `options.process` function (`process(contents)`) returning a string or a buffer who'll become the new file content. The process function will take a single contents argument who is the copied file contents as a `Buffer`.

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