log-to-json
v1.0.0
Published
Yet another transform stream to convert `.log` files to `.json`.
Downloads
79
Readme
log-to-json
Yet another transform stream to convert .log
files to .json
.
Install
Requires Node >=10.
From npm,
npm i log-to-json
From Github Package Registry. (Guide).
Type definitions are bundled with this package.
Usage
This module uses streams, so you can handle large files.
const { LogToJSON } = require('log-to-json');
// or
import { LogToJSON } from 'log-to-json';
const converter = new LogToJSON();
fs.createReadStream('my.log')
.pipe(converter)
.pipe(fs.createWriteStream('my.log.json'));
my.log
:
{"my": 5, "log":9, "file": "fsadf"}
{"my": 5, "log":9, "file": "fsadf"}
{"my": 5, "log":9, "file": "fsadf"}
{"my": 5, "log":9, "file": "fsadf"}
my.log.json
:
[
{ "my": 5, "log": 9, "file": "fsadf" },
{ "my": 5, "log": 9, "file": "fsadf" },
{ "my": 5, "log": 9, "file": "fsadf" },
{ "my": 5, "log": 9, "file": "fsadf" }
]
Do not use this module if your your log files are not JSON like.
Licence
MIT © Vajahath Ahmed