Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@spikedpunch/forge-plugin-json

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

@spikedpunch/forge-plugin-json

A @spikedpunch/forge plugin for streaming JSON

  • 0.1.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

forge-plugin-json

A JSON plugin for forge

Install

npm install @spikedpunch/forge-plugin-json

Usage

module.exports = {
   plugins: [
      { name: 'json', plugin: new JsonPlugin() }
   ],
   pipelines: {
      episodes: {
         steps: [
            {
               // Read Stream, reading from the provided files
               alias: 'import-episodes',
               plugin: 'json',
               files: [
                  'episodes/espisodes_a-d.json',
                  'episodes/espisodes_e-m.json',
                  'episodes/espisodes_n-z.json',
                  // Supports glob'd patterns too
                  'episodes/other/**/*.json'
               ]
            },
            {
               // Write stream, writing to a single file
               alias: 'write-episodes',
               use: 'import-episodes',
               plugin: 'json',
               outFile: 'built/episodes.json'
            }
         ]
      }
   }
}

Read Stream

files | string[]

List of JSON files to read from

mode | string (one of: object, sax, chunk)

The read mode.

  • object: Reads in a complete JSON object before streaming forward.
  • sax: A SAX-like token stream defined by stream-json. The format can be found in their docs.
  • chunk: Individual text chunks read in individually.

Write Stream

outFile | string

Relative path to the file to be exported

Envoy API

writeJson(filePath: string, data: any): Promise<void>

Writes data to a file as JSON

async readJson(filePath: string): Promise<any>

Reads data from a JSON file and imports it as an object.

FAQs

Package last updated on 03 Oct 2022

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc