Gathering detailed insights and metrics for read-package-json-fast
Gathering detailed insights and metrics for read-package-json-fast
Gathering detailed insights and metrics for read-package-json-fast
Gathering detailed insights and metrics for read-package-json-fast
bfj
Big-friendly JSON. Asynchronous streaming functions for large JSON data sets.
@fastify/fast-json-stringify-compiler
Build and manage the fast-json-stringify instances for the fastify framework
fast-json-stable-stringify
deterministic `JSON.stringify()` - a faster version of substack's json-stable-strigify without jsonify
fast-json-stringify
Stringify your JSON at max speed
npm install read-package-json-fast
98.6
Supply Chain
91.9
Quality
82.8
Maintenance
100
Vulnerability
100
License
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
47 Stars
104 Commits
6 Forks
7 Watching
4 Branches
70 Contributors
Updated on 05 Nov 2024
Minified
Minified + Gzipped
JavaScript (100%)
Cumulative downloads
Total Downloads
Last day
-3.2%
1,212,192
Compared to previous day
Last week
4%
6,976,411
Compared to previous week
Last month
6.3%
28,907,405
Compared to previous month
Last year
26.7%
332,628,875
Compared to previous year
3
Like read-package-json
, but faster and
more accepting of "missing" data.
This is only suitable for reading package.json files in a node_modules tree, since it doesn't do the various cleanups, normalization, and warnings that are beneficial at the root level in a package being published.
1const rpj = require('read-package-json-fast') 2 3// typical promisey type API 4rpj('/path/to/package.json') 5 .then(data => ...) 6 .catch(er => ...) 7 8// or just normalize a package manifest 9const normalized = rpj.normalize(packageJsonObject)
Errors raised from parsing will use
json-parse-even-better-errors
,
so they'll be of type JSONParseError
and have a code: 'EJSONPARSE'
property. Errors will also always have a path
member referring to the
path originally passed into the function.
To preserve indentation when the file is saved back to disk, use
data[Symbol.for('indent')]
as the third argument to JSON.stringify
, and
if you want to preserve windows \r\n
newlines, replace the \n
chars in
the string with data[Symbol.for('newline')]
.
For example:
1const data = await readPackageJsonFast('./package.json') 2const indent = Symbol.for('indent') 3const newline = Symbol.for('newline') 4// .. do some stuff to the data .. 5const string = JSON.stringify(data, null, data[indent]) + '\n' 6const eolFixed = data[newline] === '\n' ? string 7 : string.replace(/\n/g, data[newline]) 8await writeFile('./package.json', eolFixed)
Indentation is determined by looking at the whitespace between the initial
{
and the first "
that follows it. If you have lots of weird
inconsistent indentation, then it won't track that or give you any way to
preserve it. Whether this is a bug or a feature is debatable ;)
bundledDependencies
/bundleDependencies
naming to just
bundleDependencies
(without the extra d
)true
, false
, or object values passed to bundleDependencies
funding: <string>
to funding: { url: <string> }
scripts
members that are not a string value.bin
member to { [name]: bin }
.optionalDependencies
into dependencies
._id
property if name and version are set. (This is
load-bearing in a few places within the npm CLI.)README.md
file, or attach the readme to
the parsed data object.HEAD
value out of the .git
folder.tset
instead of test
)files
field exist and are
valid files.dependencies
.dependencies
fields that are not strictly objects of string values.directories
field (ie, bins, mans, and so on).No vulnerabilities found.
Reason
security policy file detected
Details
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
all changesets reviewed
Reason
license file detected
Details
Reason
0 existing vulnerabilities detected
Reason
11 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 9
Reason
SAST tool detected but not run on all commits
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
project is not fuzzed
Details
Score
Last Scanned on 2024-11-18
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More