Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
easy-read-last-lines
Advanced tools
Readme
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)
The npm package easy-read-last-lines receives a total of 0 weekly downloads. As such, easy-read-last-lines popularity was classified as not popular.
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.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.