Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
code-engine-destination-filesystem
Advanced tools
A CodeEngine plugin that reads files from the filesystem
This is a CodeEngine plugin that writes files to the filesystem (local disk or network).
NOTE: This plugin is already built-into the CodeEngine CLI, so you may not need to use it directly unless you are using CodeEngine's programmatic API.
Install using npm.
npm install code-engine-destination-filesystem
If you're using the CodeEngine CLI, then this plugin is already built-in, and you can use it simply by specifying a destination
path in your generator.
export default {
destination: "my/output/directory",
};
If you need to set more advanced options, then you will need to explicitly import and use code-engine-destination-filesystem
.
import filesystem from "code-engine-destination-filesystem";
export default {
destination: filesystem({
path: "my/output/directory",
filter: "*.html"
}),
};
You can set several options to customize the behavior of the code-engine-destination-filesystem
plugin. The only required option is path
. All others are optional.
path
The relative or absolute path of the destination directory. The directory will be created if it doesn't exist. If it does already exist, then the existing directory and its contents will be moved to trash (recycle bin on Windows), and a new directory will be created.
filter
One or more glob patterns, regular expressions, or filter functions that limit which files are written. By default, all files are written.
The filter
option can be set to a glob pattern, like this:
import filesystem from "code-engine-destination-filesystem";
export default {
destination: filesystem({
path: "my/output/directory",
filter: "**/*.html"
}),
};
It can also be set to a regular expression. For example, here's a filter
that only writes .htm
and .html
files:
import filesystem from "code-engine-destination-filesystem";
export default {
destination: filesystem({
path: "my/output/directory",
filter: /\.html?$/
}),
};
You can also use a custom function that accepts a CodeEngine File
object and returns true
if the file should be written. Here's a filter
that only writes files that do not have the word "draft" in their name:
import filesystem from "code-engine-destination-filesystem";
export default {
destination: filesystem({
path: "my/output/directory",
filter: (file) => !file.name.includes("draft")
}),
};
You can even specify multiple filters using an array. The plugin will write files that match any of the filter criteria. Here's a filter
that will write HTML files, any file in the img
directory, or any file that does not have the word "draft" in the name:
import filesystem from "code-engine-destination-filesystem";
export default {
destination: filesystem({
path: "my/output/directory",
filter: [
/\.html?$/,
"img/**/*",
(file) => !file.name.includes("draft")
]
}),
};
Another option is to specify separate include
and exclude
criteria. Each of these can be a single filter or an array of filters. For example, here's a filter
that will write HTML files or files in in the img
directory, but only if they don't contain the word "draft" in the name:
import filesystem from "code-engine-destination-filesystem";
export default {
destination: filesystem({
path: "my/output/directory",
filter: {
include: [
/\.html?$/,
"img/**/*",
},
exclude: (file) => file.name.includes("draft")
}
}),
};
This option allows you to provide your own custom implementation of the Node.js filesystem module. Examples of packages you could substitute include:
Contributions, enhancements, and bug-fixes are welcome! Open an issue on GitHub and submit a pull request.
To build the project locally on your computer:
Clone this repo
git clone https://github.com/CodeEngineOrg/code-engine-destination-filesystem.git
Install dependencies
npm install
Build the code
npm run build
Run the tests
npm test
Code Engine Destination Filesystem is 100% free and open-source, under the MIT license. Use it however you want.
This package is Treeware. If you use it in production, then we ask that you buy the world a tree to thank us for our work. By contributing to the Treeware forest you’ll be creating employment for local families and restoring wildlife habitats.
Thanks to these awesome companies for their support of Open Source developers ❤
FAQs
A CodeEngine plugin that reads files from the filesystem
The npm package code-engine-destination-filesystem receives a total of 3 weekly downloads. As such, code-engine-destination-filesystem popularity was classified as not popular.
We found that code-engine-destination-filesystem demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.