Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
files-pipe
Advanced tools
First, install the files-pipe
component like so:
npm install -D -E files-pipe
Then, create a new pipe from this component:
Index.ts
import { Files } from "files-pipe";
await new Files().In("./input");
The files-pipe
will now provide you with a pipe
method which you can use to
execute the callback on each file from the pipe.
Index.ts
import { Files } from "files-pipe";
await (
await (await new Files().In("./Input")).By("**/*.md")
).Pipe({
// Append some content to all of the text files
Wrote: (On) => (On.Buffer += "LICENSE [MIT]"),
});
These are the defaults for each callback.
import { Files } from "files-pipe";
await new Files().Pipe({
// Writes the buffer into a file
Wrote: async (On) => On.Buffer,
// Reads the file into a buffer
Read: async (On) => await fs.promises.readFile(On.Input, "utf-8"),
// Checks if the file has passed any checks
Passed: async (On) => On && true,
// When the file cannot be processed
Failed: async (Input) => `Error: Cannot process file ${Input}!`,
// When the file is processed
Accomplished: async (On) => `Processed ${On.Input} in ${On.Output}.`,
// When the whole plan is fulfilled
Fulfilled: async (Plan) =>
`Successfully processed a total of ${Plan.Files} ${
Plan.Files === 1 ? "file" : "files"
}.`,
// When the plan has changed
Changed: async (Plan) => Plan,
});
You can add multiple paths to your pipe by specifying an array as the path
variable.
Index.ts
import { Files } from "files-pipe";
await new Files().In(["./Input", "./Input2"]);
You can also provide a map of paths for different input output directories.
Index.ts
import { Files } from "files-pipe";
await new Files().In(new Map([["./Input", "./Output"]]));
You can provide a filter to exclude files from your pipe. A filter can be an array of regexes or a single match. You can use functions, as well to match on file names.
Index.ts
import { Files } from "files-pipe";
await new Files().Not([
"File.txt",
(File: string) => File === "./Input/File.txt",
]);
Set logger
to 0
if you do not want to see debug messages. Default is 2
.
Index.ts
import { Files } from "files-pipe";
new Files(0);
See CHANGELOG.md for a history of changes to this component.
FAQs
🧪 File Pipe.
The npm package files-pipe receives a total of 1,820 weekly downloads. As such, files-pipe popularity was classified as popular.
We found that files-pipe demonstrated a healthy version release cadence and project activity because the last version was released less than 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
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.