"Fossies" - the Fresh Open Source Software Archive

Member "Atom/resources/app/apm/node_modules/realize-package-specifier/README.md" (17 Oct 2016, 2922 Bytes) of archive /windows/misc/atom-windows.zip:

As a special service "Fossies" has tried to format the requested source page into HTML format (assuming markdown format). Alternatively you can here view or download the uninterpreted source code file. A member file download can also be achieved by clicking within a package contents listing on the according byte size field.


Parse a package specifier, peeking at the disk to differentiate between local tarballs, directories and named modules. This implements the logic used by npm install and npm cache to determine where to get packages from.

javascript var realizePackageSpecifier = require("realize-package-specifier") realizePackageSpecifier("foo.tar.gz", ".", function (err, package) { … })


Parses spec using npm-package-arg and then uses stat to check to see if it refers to a local tarball or package directory. Stats are done relative to where. If it does then the local module is loaded. If it doesn’t then target is left as a remote package specifier. Package directories are recognized by the presence of a package.json in them.

spec – a package specifier, like: foo@1.2, or foo@user/foo, or http://x.com/foo.tgz, or git+https://github.com/user/foo

where (optional, default: .) – The directory in which we should look for local tarballs or package directories.

callback function(err, result) – Called once we’ve determined what kind of specifier this is. The result object will be very like the one returned by npm-package-arg except with three differences: 1) There’s a new type of directory. 2) The local type only refers to tarballs. 2) For all local and directory type results spec will contain the full path of the local package.

Result Object

The full definition of the result object is: