Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
easy-read-last-lines
Advanced tools
Read the last N lines in the file or text across platforms. (like tail -n)
High performance read the last N lines in the file or text across platforms. (like tail -n)
\r
, \n
, \r\n
encoding
String
or Buffer
object from filenpm install easy-read-last-lines
const erll = require('easy-read-last-lines');
let fielPath='YOUR_FILE_PATH';
// Read last N lines string from File - Asynchronously
erll.readFromFile(filePath, 3).then(function(lines) {
console.log(lines);
}).catch(function(err) {
console.log(err.message);
});
// Read last N lines string from File - Synchronously
let lines = await erll.readFromFile(filePath, 3, 'utf8');
console.log(lines);
// Read an array of last N line string from File
let linesArray = await erll.readArrayFromFile(filePath, 3, 'utf8');
console.log(linesArray);
let fielPath='YOUR_FILE_PATH';
// Asynchronously
erll.readBufferFromFile(filePath, 1).then(function(buffer) {
console.log(buffer.toString('base64'));
}).catch(function(err) {
console.log(err.message);
});
// Synchronously
let buffer = await erll.readBufferFromFile(filePath, 1);
console.log(buffer.toString('base64'));
var text = `
Easy
Read
Last
Line`;
var text2 = `Easy\nRead\rLast\r\nLine`
// Read last N lines string from Text
var lines = erll.readFromText(text, 2);
console.log(lines);
// Read an array of last N line string from Text
var linesArray = erll.readArrayFromText(text2, 3);
console.log(linesArray);
var text = `Easy\nRead\rLast\r\nLine`;
console.log(erll.linesToArray(lines));
readFromFile(filePath, maxLine, [encoding]): Promise
filePath
: file path(direct or relative path to file)maxLine
: max number of last lines to read inencoding
: When converting between Buffers and strings, a character encoding may be specified. If no character encoding is specified, UTF-8
will be used as the default. buffers-and-character-encodingsreadArrayFromFile(filePath, maxLine, [encoding]): Promise
filePath
: file path(direct or relative path to file)maxLine
: max number of last lines to read inencoding
: When converting between Buffers and strings, a character encoding may be specified. If no character encoding is specified, UTF-8
will be used as the default. buffers-and-character-encodingsreadBufferFromFile(filePath, maxLine): Promise
filePath
: file path(direct or relative path to file)maxLine
: max number of last lines to read inreadFromText(text, maxLine): String
text
: multiline stringmaxLine
: max number of last lines to read inreadArrayFromText(text, maxLine): String
text
: multiline stringmaxLine
: max number of last lines to read inlinesToArray(text): Array
text
: multiline stringMIT License
Email:inthinkcolor@gmail.com
Donation/捐助:
我们相信,每个人的点滴贡献,都将是推动产生更多、更好免费开源产品的一大步。
感谢慷慨捐助,以支持服务器运行和鼓励更多社区成员。
We believe that the contribution of each bit by bit, will be driven to produce more and better free and open source products a big step.
Thank you donation to support the server running and encourage more community members.
FAQs
Read the last N lines in the file or text across platforms. (like tail -n)
We found that easy-read-last-lines demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.