Registry / devops / electron-docs

electron-docs

JSON →
library3.0.2jsnpmunverified

Fetches Electron documentation as raw markdown strings from GitHub or local directories. Version 3.0.2 is the current stable release. It downloads the Electron repo, extracts markdown files from the docs/ folder, and returns an array of objects with slug, filename, and markdown_content. Supports remote branches, version numbers, commit SHAs, or local paths. Used internally by Electron's docs linter. Dependencies include got, gunzip-maybe, tar-fs, and pify.

npm install electron-docs
INSTALL
IMPORT
SIG · ELECTRON-DOCS
E
electron-docs
devopsjavascriptv3.0.2
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

electronDocs
const electronDocs = require('electron-docs')
import electronDocs from 'electron-docs'
Package uses CommonJS require; no default ESM export. Use const with require().
electronDocs
import electronDocs from 'electron-docs'
If using ESM, this works with Node >=13.2 or with module bundlers.
electronDocs
const electronDocs = require('electron-docs')
import { electronDocs } from 'electron-docs'
Named import does not exist; electronDocs is the default export via module.exports.

Shows CommonJS require, promise and callback usage, fetching docs from remote branch or local directory.

const electronDocs = require('electron-docs'); // Fetch docs from a remote branch electronDocs('master').then(docs => { docs.forEach(doc => { console.log(doc.slug, doc.filename); }); }).catch(err => console.error(err)); // Or from a local directory const path = require('path'); const localPath = path.join(__dirname, 'path/to/electron-repo'); electronDocs(localPath).then(docs => { // process docs }); // Node-style callback electronDocs('1.4.4', (err, docs) => { if (err) return console.error(err); console.log(docs.length, 'documents fetched'); });
Debug
Known issues
breakingelectron-docs v1.x uses callbacks only; v2.x and v3.x return promises by default.
fix
Upgrade to v3.x and use .then() or await. For callbacks, pass a function as second argument.
affects: <=1.0.0
gotchaWhen using a local directory, you must provide an absolute path relative paths will throw an error.
fix
Always use path.resolve or path.join with __dirname.
affects: >=0.0.0
gotchaThe array returned does not include a docs index file; only actual markdown documentation files.
fix
Handle the array directly; it contains objects with slug, filename, and markdown_content.
affects: >=0.0.0
breakingv3.0.0 dropped support for Node <8.
fix
Update to Node >=8.
affects: >=3.0.0
Errors
Common errors & fixes
TypeError: electronDocs is not a function
Using destructured or named import incorrectly
fix
Use const electronDocs = require('electron-docs') or import electronDocs from 'electron-docs'.
Error: ENOENT: no such file or directory, stat 'C:\Users\...\docs'
Relative path passed when a local directory is required, or directory does not exist
fix
Use path.resolve to create an absolute path before calling electronDocs.
UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'map' of undefined
Passing an invalid version string or branch name that doesn't exist
fix
Ensure the argument is a valid branch, version, or commit SHA. Check network connectivity.
Upgrade
Version history
3.0.2latest on npm
Audit
Dependencies
gotrequiredHTTP client for fetching tarballs from GitHub
gunzip-mayberequiredDecompresses gzipped tarballs
node-dirrequiredReads files from local directories
orarequiredShows a spinner during long operations
path-existsrequiredChecks if a local path exists
pifyrequiredPromisifies callback-style functions
semverrequiredParses version strings
tar-fsrequiredExtracts tarballs to the filesystem
Agent activity
11 hits · last 30 days
node
10
Amazon
1
Resources
electron-docs — npm install electron-docs · libregistry