Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

file-lines-stream

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

file-lines-stream

This package allows to read files line by line in both directions. It supports node stream and WebStream API

latest
Source
npmnpm
Version
0.2.0
Version published
Maintainers
1
Created
Source

file-lines-stream

Version License

This package allows to read files line by line in both directions. It supports node stream and WebStream API

Basic usage

WebStream API

import { createForwardReadableStream } from "file-lines-stream/WebStream";

const stream = await createForwardReadableStream('file.txt');
stream.pipeTo(new WritableStream({ write: line => console.log(line) }));
import { createBackwardReadableStream } from "file-lines-stream/WebStream";

const stream = await createBackwardReadableStream('file.txt');
stream.pipeTo(new WritableStream({ write: line => console.log(line) }));

node stream

import { createForwardReadStream } from "file-lines-stream/stream";
import { Writable } from 'stream';

const stream = await createForwardReadStream('file.txt');
stream.pipe(new Writable({
  objectMode: true,
  write: (line, _, cb) => {
    console.log(line);
    cb();
  }
}));
import { createBackwardReadStream } from "file-lines-stream/stream";
import { Writable } from 'stream';

const stream = await createBackwardReadStream('file.txt');
stream.pipe(new Writable({
  objectMode: true,
  write: (line, _, cb) => {
    console.log(line);
    cb();
  }
}));

Keywords

file

FAQs

Package last updated on 26 Feb 2023

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