
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
json-archive
Advanced tools
Simple archive format based on JSON.
npm install --save json-archive
The following interface is provided:
interface JSONArchive {
pack ( folderPath: string, options?: VisitOptions ): Promise<Archive>;
unpack ( archivePath: string, options?: VisitOptions ): Promise<Archive>;
visit ( archive: Archive, options?: VisitOptions ): Promise<Archive>;
};
// Types
type Promisable<T> = T | Promise<T>;
type Filter = ( filePathRelative: string ) => Promisable<boolean>;
type Transform = ( file: File ) => Promisable<File>;
type Visit = ( filePathRelative: string, file: File ) => Promisable<void>;
type Encoding = 'ascii' | 'base64' | 'base64url' | 'binary' | 'hex' | 'latin1' | 'utf8' | 'utf-8' | 'utf16le' | 'ucs2' | 'ucs-2';
type File = {
contents: string,
encoding: Encoding
};
type Archive = {
[filePathRelative: string]: File
};
type VisitOptions = {
filter?: Filter,
transform?: Transform,
visit?: Visit
};
Do this to pack a directory:
import fs from 'fs';
import {pack} from 'json-archive';
const archive = await pack ( 'path/to/dir' );
fs.writeFileSync ( 'archive.json', JSON.stringify ( archive ) );
Do this to unpack an archive:
import fs from 'fs';
import {unpack} from 'json-archive';
const archive = await unpack ( 'archive.json' );
Do this to filter/transform/traverse an archive:
import fs from 'fs';
import {visit} from 'json-archive';
const transformedArchive = await visit ( archive, {
filter: filePath => {
return !filePath.startsWith ( '.' );
},
visit: ( filePath, file ) => {
fs.writeFileSync ( filePath, file.contents, { encoding: 'base64' } );
}
});
MIT © Fabio Spampinato
FAQs
Simple archive format based on JSON.
We found that json-archive 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.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.