signalk-server
Version:
An implementation of a [Signal K](http://signalk.org) server for boats.
15 lines • 688 B
TypeScript
/**
* Convert an npm package name into a filesystem-safe segment for use as
* a cache file or directory name. The result is guaranteed to:
* - contain no path separators (`/`, `\`)
* - contain no path-traversal `..`
* - contain no NUL bytes
*
* so a crafted name (e.g. `../etc/passwd`) cannot resolve a cache
* file outside its intended directory when joined with `path.join`.
* Both `/` and `\` are replaced with `__` (so `@signalk/foo` becomes
* `@signalk__foo` on every platform); `..` is replaced with `__` so it
* cannot survive as a path component; NUL bytes are stripped.
*/
export declare function safeName(pkg: string): string;
//# sourceMappingURL=safe-name.d.ts.map