npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

pathslash

v0.1.0

Published

node:path, platform-correct, with forward-slash output.

Downloads

5,228

Readme

pathslash

node:path, platform-correct, with forward-slash output.

pathslash is a tiny wrapper around node:path that always outputs forward slashes (/) while keeping the correct per-platform semantics. It never reimplements path logic. Every function delegates to node:path and only flips the separators in the result.

Why

  • Forward slashes everywhere. On Windows, the win32 functions output / instead of \, which is what bundlers, route maps, and URLs expect.
  • Correct semantics for free. Drive letters, UNC paths, and case-insensitive relative behave exactly as in node:path, because they are node:path.
  • POSIX-safe. On POSIX, a backslash is a valid filename character, so it is never rewritten there.
  • A typed drop-in. Same API and types as node:path.

Install

npm i pathslash

Usage

The default export and the top-level named exports follow the host platform, exactly like node:path:

import path, { join } from "pathslash";

join("src", "a.ts"); // 'src/a.ts'
path.sep; // '/'

To force a specific platform, use the win32 and posix namespaces. They work on any host OS:

import { win32, posix } from "pathslash";

win32.join("C:\\a", "b"); // 'C:/a/b'  (forward slashes)
win32.normalize("C:\\a\\..\\b"); // 'C:/b'
win32.relative("C:/Foo/Bar", "C:/foo/baz"); // '../baz'  (case-insensitive)

posix.join("a", "b\\c"); // 'a/b\\c'  (backslash kept)

toSlash(path)

Safely normalizes separators to /. On Windows it converts \ to /. On POSIX it returns the path unchanged, because a backslash is a valid filename character there and rewriting it would corrupt the path. Use it for paths that come from outside this package, such as process.cwd():

import { toSlash } from "pathslash";

toSlash("C:\\a\\b"); // 'C:/a/b' on Windows, unchanged on POSIX

Notes

  • win32.sep is "/" instead of "\\", and win32.delimiter stays ";".
  • \\?\ (extended-length) paths stay verbatim. toSlash and every win32.* function leave them untouched, because a forward slash is a literal character there, not a separator.
  • toNamespacedPath always returns a native, backslash path, since \\?\ paths are only valid with backslashes.
  • matchesGlob mirrors node:path. It exists only on Node versions that ship it (22.5+) and is undefined on older ones.
  • The types are a drop-in too: import type { ParsedPath, FormatInputPathObject, PlatformPath } from "pathslash".
  • Everything else matches node:path, separators aside.

License

MIT