
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.
@transcend-io/conflux
Advanced tools
Build and read zip files with whatwg streams in the browser.
Chrome | ✅ |
Safari | ✅ |
Edge | ✅ |
Firefox | ✅ |
npm install --save @transcend-io/conflux
// Reader parses zip files, Writer builds zip files
import { Reader, Writer } from '@transcend-io/conflux';
ReadableStream#pipeThrough
import { Writer } from '@transcend-io/conflux';
import streamSaver from 'streamsaver';
const s3 = 'https://s3-us-west-2.amazonaws.com/your-bucket/';
const files = ['NYT.txt', 'water.png', 'Earth.jpg'].values();
const myReadable = new ReadableStream({
async pull(controller) {
const { done, value } = files.next();
if (done) return controller.close();
const { body } = await fetch(s3 + value);
return controller.enqueue({
name: `/${value}`,
stream: () => body,
});
},
});
myReadable
.pipeThrough(new Writer())
.pipeTo(streamSaver.createWriteStream('conflux.zip'));
// optionally, you can pass in a [queueing strategy](https://developer.mozilla.org/en-US/docs/Web/API/TransformStream/TransformStream#writablestrategy)
// to the constructure in order to specify the number of streams being consumed at a time
// default queue size is one, meaning only a single stream will be processed at a time
myReadable
.pipeThrough(
new Writer({
// Write stream will allow 5 chunks in the underlying queue.
// Once the entry's stream returns `done`, a new entry will be pulled
// from `myReadable`.
highWaterMark: 5,
// each "chunk" in the queue represents 1 out of the total 5 we set for our limit
size: (_: ZipTransformerEntry) => 1,
}))
.pipeTo(streamSaver.createWriteStream('conflux.zip'));
writer.write
import { Writer } from '@transcend-io/conflux';
import streamSaver from 'streamsaver';
// Set up conflux
const { readable, writable } = new Writer();
const writer = writable.getWriter();
// Set up streamsaver
const fileStream = streamSaver.createWriteStream('conflux.zip');
// Add a file
writer.write({
name: '/cat.txt',
lastModified: new Date(0),
stream: () => new Response('mjau').body,
});
readable.pipeTo(fileStream);
writer.close();
import { Writer } from '@transcend-io/conflux';
import streamSaver from 'streamsaver';
const { readable, writable } = new Writer();
const writer = writable.getWriter();
const reader = readable.getReader();
// Set up streamsaver
const fileStream = streamSaver.createWriteStream('conflux.zip');
(async () => {
writer.write({
name: '/cat.txt',
lastModified: new Date(0),
stream: () => new Response('mjau').body,
});
const imgStream = await fetch(
'https://s3-us-west-2.amazonaws.com/your-bucket/Earth.jpg',
).then((r) => r.body);
writer.write({
name: '/Earth.jpg',
lastModified: new Date(0),
stream: () => imgStream,
});
readable.pipeTo(fileStream);
writer.close();
})();
import { Reader } from '@transcend-io/conflux';
fetch('https://cdn.jsdelivr.net/gh/Stuk/jszip/test/ref/deflate.zip').then(
async (res) => {
const zip = await res.blob();
for await (const entry of Reader(zip)) {
console.log(entry);
}
},
);
Conflux is compatible with all modern browsers since June 2022.
If you need to support legacy browsers, you can add polyfills for:
TransformStream
, and WritableStream
(available in browsers since June 2022) by adding web-streams-polyfill.BigInt
(available in browsers since January 2020) by setting globalThis.JSBI
equal to JSBI before importing Conflux.globalThis
(available in browsers since January 2020) by adding a polyfill like this globalthis or manually setting a shim.FAQs
Build zip files out of readable streams in the browser
The npm package @transcend-io/conflux receives a total of 4,883 weekly downloads. As such, @transcend-io/conflux popularity was classified as popular.
We found that @transcend-io/conflux demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 7 open source maintainers 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.