
Research
Malicious npm Packages Impersonate Flashbots SDKs, Targeting Ethereum Wallet Credentials
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
@ronpark/temp-files
Advanced tools
A utility for creating and managing temporary files and directories for testing, with automatic cleanup.
The temp-files
utility simplifies the creation of temporary files and directories for testing purposes. It is ideal for setting up a specific file structure for tests and ensures automatic cleanup after the tests are complete.
You can install temp-files
via npm:
npm install @ronpark/temp-files --save-dev
Here's a quick example of how to use temp-files
in a Jest test:
import fs from 'fs';
import path from 'path';
import { afterEach, describe, expect, it } from '@jest/globals';
import tempFiles from 'temp-files';
describe('Example test with tempFiles', () => {
let basePath: string;
let cleanUpFunc: (() => void) | null = null;
afterEach(() => {
cleanUpFunc?.();
});
it('should create and read temporary files correctly', () => {
[basePath, cleanUpFunc] = tempFiles({
'test.txt': 'Hello, world!',
});
const filePath = path.join(basePath, 'test.txt');
expect(fs.existsSync(filePath)).toBe(true);
expect(fs.readFileSync(filePath, 'utf8')).toBe('Hello, world!');
});
});
tempFiles(fileMap: Record<string, string>, options?: { maxRetries?: number }): [string, () => void]
fileMap
: An object where keys are file paths and values are file contents.options
(optional): Configuration object with a maxRetries
property to specify the number of retries for generating a unique path (default is 10).basePath
: The path to the temporary directory.cleanUpFunc
: A function to clean up the temporary files.MIT License.
FAQs
A utility for creating and managing temporary files and directories for testing, with automatic cleanup.
We found that @ronpark/temp-files demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 open source maintainers 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
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.