New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

archive-stream

Package Overview
Dependencies
Maintainers
0
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

archive-stream

Archive Stream Implementation of Node.js

latest
Source
npmnpm
Version
0.0.4
Version published
Maintainers
0
Created
Source

node-archive-stream

Unix ar archives stream for Node.js

Example

  • ReadStream
export interface IArchiveEntry {
  name: string;
  mtime: number;
  ownerId: number;
  groupId: number;
  mode: string;
  size: number;
  content: Buffer;
}
import { createReadStream } from "fs";
import { createArchiveStream } from "../lib";

const archiveStream = createArchiveStream();
const rs = createReadStream("test.deb");
rs.pipe(archiveStream);

archiveStream.on("data", (x: IArchiveEntry) => console.log(x));
  • WriteStream
export interface WriteArchiveEntry
  extends Omit<IArchiveEntry, "content" | "size"> {
  size?: number; //10
  content: Buffer | ArrayBufferLike | Readable;
}
import { createWriteStream } from "fs";
import { createUnArchiveStream, WriteArchiveEntry } from "../lib";

const unArchiveStream = createUnArchiveStream();
const ws = createWriteStream("test.deb");
unArchiveStream.pipe(ws);

unArchiveStream.write({
  name: "test.log",
  mtime: 0,
  ownerId: 0,
  groupId: 0,
  mode: "644",
  content: Buffer.from("test\n"),
} as WriteArchiveEntry);
  • Handle
import { Archive } from "../lib";
const archive = await Archive.open("tests/example.deb", {
  //   noEndCheck: true,
});
console.log(archive.entries);
/**  @type {ArchiveEntry};*/
const data = archive.entries.find((item) => item.name == "control.tar.zst");
console.log(await archive.read(data!));

Reference:

Ar_(Unix) - Wikipedia

LICENSE

MIT LICENSE

Keywords

ar

FAQs

Package last updated on 25 Sep 2024

Did you know?

Socket

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.

Install

Related posts