
Security News
vlt Launches "reproduce": A New Tool Challenging the Limits of Package Provenance
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
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 978 weekly downloads. As such, files-pipe popularity was classified as not 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.
Security News
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.