
Product
Unify Your Security Stack with Socket Basics
A single platform for static analysis, secrets detection, container scanning, and CVE checks—built on trusted open source tools, ready to run out of the box.
Express middleware for implementing a KSP package repository according to the KPM communication spec.
KPM-API is an ExpressJS middleware for implementing the API required for a Kerbal Package Manager repository.
Install through npm
like so:
npm install kpm-api --save
Example:
var express = require('express'),
kpmApi = require('kpm-api'),
app = express();
app.use(kpmApi({
base: '/api',
list: function(page, size, callback) {
// code to retrieve a list of available packages.
// pass result to callback when done.
callback([]);
},
fetch: function(id, version, callback) {
// code to retrieve a stream or buffer for the
// specified package and version. pass result to
// callback when done.
callback(null); // package not found.
},
exists: function(id, version, callback) {
// code to determine whether specified package exists.
// return result (either true or false) to callback.
callback(false);
}
});
base (optional) - The base path to install the API under.
/
list (required) - A handler for listing available packages in the repository. Takes an index for the page requested(page
), the page size(size
), and a callback(callback
) for returning the result.
size
will be -1
if not specified. This would mean paging is not active.callback
expects an Array
.callback
will return an empty Array
if the result is null
or undefined
.page
is zero-based.fetch (required) - a handler for retrieving a package. Takes a package id
, version
, and callback
for returning the result.
version
may be blank. This means the latest version available.callback
expects a readable stream
or Buffer
.null
or undefined
result means the package was not found and the server will respond with 404.stream
or Buffer
, the middleware will pass an error to the next middleware.exists (required) - a handler for determining if a package is available within the repository. Like fetch, it takes an id
, version
, and callback
.
version
may be blank. This means the latest version available.callback
expects either true
or false
.If you see a bug or have a suggestion, feel free to create an issue here.
MIT License. Copyright 2014 Daniel Krainas http://www.danielkrainas.com
FAQs
Express middleware for implementing a KSP package repository according to the KPM communication spec.
The npm package kpm-api receives a total of 2 weekly downloads. As such, kpm-api popularity was classified as not popular.
We found that kpm-api demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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.
Product
A single platform for static analysis, secrets detection, container scanning, and CVE checks—built on trusted open source tools, ready to run out of the box.
Product
Socket is launching experimental protection for the Hugging Face ecosystem, scanning for malware and malicious payload injections inside model files to prevent silent AI supply chain attacks.
Research
/Security News
The Socket Threat Research Team uncovered a coordinated campaign that floods the Chrome Web Store with 131 rebranded clones of a WhatsApp Web automation extension to spam Brazilian users.