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

pedantry

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pedantry

Read a directory recursively as a stream in Node.js.

  • 1.0.0
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

pedantry

npm version

pedantry is a Node.js package that implements a readable stream which puts together of all files in the directory in the sorted order. It also supports reading index.md and footer.md as first and last files respectively if found.

yarn add -E pedantry

Table Of Contents

API

The main export of the program is the Pedantry duplex stream which should only be used as a Readable.

import Pedantry from 'pedantry'

constructor(
  source: string,
): Pedantry

Upon creation, Pedantry will start reading files in the source directory recursively in the following order:

  • the content of the index.md file will go first if it exists,
  • then of all files and directories in the folder recursively in a sorted order,
  • and the content of the footer.md file will go last if found.

Given the directory structure:

example/test
├── 1-words.md
├── 2-believe.md
├── 3-brick.md
├── footer.md
└── index.md

The usage of Pedantry is as below:

import Catchment from 'catchment'
import Pedantry from 'pedantry'

(async () => {
  try {
    const pedantry = new Pedantry('example/test')
    const catchment = new Catchment()
    pedantry.pipe(catchment)
    const res = await catchment.promise
    console.log(res)
  } catch ({ stack }) {
    console.log('stack')
  }
})()

(c) Art Deco Code 2018

Keywords

FAQs

Package last updated on 21 Jun 2018

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