New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

aline

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

aline

Align stream chunks to bound of lines

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

node-aline

Align last bytes to newline boundary of stream chunks

Install

NPM

npm install aline

Yarn

yarn add aline

Sample Node.js Stream Transform

const {Aline} = require('aline');
const {Readable} = require('stream');

async function* generate() {
    yield 'foo\nba';
    yield 'ar\nbaz';
}

const stream = Readable.from(generate()).pipe(new Aline());

stream.on('data', function(chunk) {
    console.log(chunk.toString());
});

Sample Web TransformStream

const {AlineWeb} = require('aline');

async function main() {
    const response = await fetch('https://example.com/big.jsonl');

    if (!response.body) {
        return;
    }

    const readable = response.body
        .pipeThrough(new TransformStream(new AlineWeb()))
        .pipeThrough(new TextDecoderStream());

    for await (const batch of readable) {
        const jsonLines = batch.split(/\n/g).map(line => JSON.parse(line));
    }
}

Keywords

FAQs

Package last updated on 05 May 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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc