log-to-json
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

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

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.0
    25
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.0
    25

Package Sidebar

Install

npm i log-to-json

Weekly Downloads

19

Version

1.0.0

License

MIT

Unpacked Size

13 kB

Total Files

5

Last publish

Collaborators

  • vaju