txtar
v1.0.1
Published
This is a nodejs module for reading [txtar](https://pkg.go.dev/golang.org/x/tools/txtar#hdr-Txtar_format)
Downloads
1,072
Readme
txtar
This is a nodejs module for reading txtar
Usage
Given a txtar file, eg example.txtar
with the following contents
Some comment
-- file1.txt --
file1 contents
-- file2.txt --
file2 contents
You can parse it like this
import { parseFile } from "txtar";
const archive = await parseFile("./example.txtar");
console.log(archive.comment); // Some comment
console.log(archive.files[0].name); // file1.txt
console.log(archive.files[0].data); // file1 contents