
Research
Two Malicious Rust Crates Impersonate Popular Logger to Steal Wallet Keys
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
Filesystem utilities for recursively creating and reading file structures.
fsn.parse(inputStructure)
takes an input file structure then parses and normalizes it to work with the package.
It converts files, directories and symlinks to a tree of objects of type:
FileNode
, DirectoryNode
or SymlinkNode
import * as fsn from '@nkp/fs';
import crypto from 'crypto';
// you have some flexibility in how you write the file structure
const fileStructure = fsn.parse(['/absolute/path/to/mount/point', [
['file_1', 'file 1 content'],
['file_2', { write: 'file 2 content' }],
['file_3', { write: 'file 3 content', encoding: 'utf-8' }],
['file_4', { write: async () => ({ content: 'file 3 content' }), encoding: 'utf-8' }],
['file_4', { write: async () => ({ content: crypto.randomBytes(56), encoding: 'binary' }), }],
['file_4', { write: async () => ({ content: crypto.randomBytes(56), encoding: 'binary' }), }],
{
name: 'file_4',
write: async () => ({ content: crypto.randomBytes(56), encoding: 'binary' }),
},
['directory_1', []],
{ name: 'directory_1', children: [] },
['directory_2', [
['nestedfile', 'nested file content2' ],
]],
{ name: 'directory_2', children: [
{ name: 'nested_file', write: 'nested file content' },
{ name: 'directory_2_nesting', children: [
{ name: 'double_nested_file', write: 'doubl nested file' },
]},
]},
['symlink', { link: './file_4' }],
]]);
// fileStructure: [MountNode] {
// absolutePath: string,
// type: 'Node:Mount'
// children: [
// [FileNode] {
// type: 'Node:File',
// name: 'file_1',
// write: async () => ({ content: 'file 1 content', encoding: 'utf-8' })
// override: false,
// absolutePath: string,
// relativePath: string,
// },
// [FileNode] {
// type: 'Node:File',
// name: 'file_2',
// write: async () => ({ content: 'file 2 content', encoding: 'utf-8' })
// override: false,
// absolutePath: string,
// relativePath: string,
// },
// ...
// ]
// }
Recursively reads from the file system into a structure of linked FileNode
, DirectoryNode
, SymlinkNode
and ExoticNode
.
import * as afsn from '@nkp/fs';
const fileStructure = await fsn.read('/absolute/path/to/read/point');
// fileStructure: [Node:Directory] {
// name: string,
// absolutePath: string,
// type: 'Node:Directory'
// children: [
// [FileNode] {
// type: 'Node:File',
// name: 'file_1',
// write: null,
// override: false,
// absolutePath: string,
// relativePath: string,
// },
// [FileNode] {
// type: 'Node:File',
// name: 'file_2',
// write: null,
// override: false,
// absolutePath: string,
// relativePath: string,
// },
// ...
// ]
// }
Recursively write a file structure to the file system.
import * as fsn from '@nkp/fs';
const structure = fsn.parse(/* some parseable structure */);
await fsn.write(structure);
Flatten a nested file structure into an array of nodes
import * as fsn from '@nkp/fs';
const structure = fsn.parse(/* some parseable structure */);
const flat: (FileNode | DirectoryNode | SymlinkNode | ExoticNode)[] = fsn.flatten(structure);
//
To a release a new version:
master
branch on GitHubnew release
on GitHub for the latest versionThis will trigger a GitHub action that tests and publishes the npm package.
FAQs
Filesystem utilities for recursively creating and reading files
We found that @nkp/fs 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
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
Research
A malicious package uses a QR code as steganography in an innovative technique.
Research
/Security News
Socket identified 80 fake candidates targeting engineering roles, including suspected North Korean operators, exposing the new reality of hiring as a security function.