
Security News
npm Introduces minimumReleaseAge and Bulk OIDC Configuration
npm rolls out a package release cooldown and scalable trusted publishing updates as ecosystem adoption of install safeguards grows.
Parse Pear Links. This includes URLs with pear: & file: protocols.
npm install pear-link
The pear: protocol supports the following syntax:
pear://[<fork>.][<length>.]<keyOrAlias>[.<dhash>]<path>[?<search>][#<lochash>]
fork is the fork id for the underlying hypercore.length is the length of the underlying hypercore.keyOrAlias is the z32 or hex encoded key or an alias for the key.path is zero or more path segments separated by a /.search is a query string of non-hierarchical data proceeded by a question
mark (?).lochash is the fragment proceeded by a hash (#).const plink = require('pear-link')Exports a singleton with methods parse, serialize and normalize.
Supports aliases per pear-aliases.
const { protocol, pathname, search, hash, origin, drive } = plink.parse(url)Parses the provided url string returning an object describing the URL's
properties.
The returned object contains the following:
{
protocol, // The url's protocol. Supported protocols include `pear:` & `file:`
pathname, // The `some/path` in `pear://key/some/path`. Same as the standard URL pathname
search, // The query string in the URL, aka anything after a `?` including the `?`
hash, // The fragment part of the URL, eg `#fragment` in `pear://key/path#fragment`. Includes the `#`.
origin: this.normalize(`${protocol}//${hostname}${pathname}`),
drive: {
key, // The key for the hyperdrive. Usually the `key` part of a pear link.
length, // The hyperdrive length defined in the URL.
fork, // The hyperdrive fork defined in the URL.
hash, // The dhash in the URL.
}
}
const normalizedLink = plink.normalize(link)Normalizes the link by removing trailing path separators (/).
const link = plink.serialize({ protocol, pathname, search, hash, drive })Returns the serialized version of the object describing a URL as a string.
Apache-2.0
FAQs
Parse Pear Links
The npm package pear-link receives a total of 1,123 weekly downloads. As such, pear-link popularity was classified as popular.
We found that pear-link demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?

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.

Security News
npm rolls out a package release cooldown and scalable trusted publishing updates as ecosystem adoption of install safeguards grows.

Security News
AI agents are writing more code than ever, and that's creating new supply chain risks. Feross joins the Risky Business Podcast to break down what that means for open source security.

Research
/Security News
Socket uncovered four malicious NuGet packages targeting ASP.NET apps, using a typosquatted dropper and localhost proxy to steal Identity data and backdoor apps.