ipfs-zip-stream
TypeScript icon, indicating that this package has built-in type declarations

1.1.1 • Public • Published

README.md

get files from zip for ipfs.add
import { readFile } from 'fs-extra';
import { join } from 'path';
import { fromBuffer, fromJSZip } from 'ipfs-zip-stream';
import publishToIPFSRace from 'fetch-ipfs/lib/put/race';
import { filterList } from 'ipfs-server-list/index';
import JSZip from 'jszip';
import useIPFS from 'use-ipfs';

(async () =>
{

	let ls = fromBuffer(readFile(join(__dirname, 'res', 'wenku8_2324.epub')))

	const { ipfs, stop } = await useIPFS();

	await publishToIPFSRace(ls, [
		ipfs,
	], {
		addOptions: {
			pin: false,
			wrapWithDirectory: true,
		}
	})
		.then(ls =>
		{
			// @ts-ignore
			let last = ls[0].value[ls[0].value.length - 1];

			console.dir(last)
			console.dir(last.cid.toString())

		})
	;

	//return stop()
})();

Dependencies (4)

Dev Dependencies (0)

    Package Sidebar

    Install

    npm i ipfs-zip-stream

    Weekly Downloads

    0

    Version

    1.1.1

    License

    ISC

    Unpacked Size

    17.6 kB

    Total Files

    6

    Last publish

    Collaborators

    • bluelovers