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

@antzsoft/filekit-server

v1.0.1

Published

FileKit server SDK — upload, download, fetch and signed URLs for S3, Azure Blob, local/mounted disk, remote file servers, SFTP and FTP, with multiple providers at once. Stateless: no database.

Readme

@antzsoft/filekit-server

One server-side API to upload, download and share files on S3 (and S3-compatible stores), Azure Blob, a local or mounted folder, a remote file server, SFTP and FTP/FTPS — several at once.

  • Stateless — no database. FileKit moves bytes and signs URLs; you keep the returned StoredObject.
  • Every upload style — direct from the browser (single or parallel multipart), through your server (proxy), server-side buffers/streams, batches, through your own API with no URL, scoped S3 credentials.
  • Every download style — signed links (direct or proxied), public links, streaming in your own route, buffers.
  • Thumbnails and resized images — variants made on first use (or at upload), stored next to the original on any storage, deleted with it; can reuse copies an earlier resizer made.
  • Your server decides, per provider — direct or proxy uploads, public or signed downloads by folder, file-type/size policy, URL lifetimes.
  • Safe by default — tamper-proof tickets; size and type verified on completion (a mismatching file is deleted); key validation; public files only where you allow them.
  • Fits any framework — Express 4/5 middleware, NestJS module (tested on Nest 10 and 11), plain Node handler; extra response headers (e.g. CORP behind helmet). Streams end to end (1 GiB uploads stay under ~70 MiB of memory). ESM + CommonJS, Node ≥ 18.17 — on Node 18/20 pin storage SDK versions as listed in the guide §2.

Install

npm install @antzsoft/filekit-server

Then only what your storage needs:

| Storage | Install | |---|---| | S3 / MinIO / R2 / Wasabi | npm install @aws-sdk/client-s3 @aws-sdk/lib-storage @aws-sdk/s3-presigned-post @aws-sdk/s3-request-presigner (+ @aws-sdk/client-sts for scoped credentials) | | Azure Blob | npm install @azure/storage-blob | | SFTP | npm install ssh2-sftp-client | | FTP / FTPS | npm install basic-ftp | | Local folder, remote file server | nothing extra | | Image variants (optional) | npm install sharp |

Quick start (Express)

import express from 'express';
import { createFileKit } from '@antzsoft/filekit-server';
import { createFileKitMiddleware } from '@antzsoft/filekit-server/express';
import { s3 } from '@antzsoft/filekit-server/s3';

const filekit = createFileKit({
  provider: s3({
    bucket: 'app-media', region: 'ap-south-1',
    download: { rules: [{ prefix: 'public/', access: 'public' }], publicUrl: 'https://cdn.example.com' },
  }),
  secret: process.env.FILEKIT_SECRET!,            // ≥ 32 random characters
  publicUrl: 'https://api.example.com/filekit',  // where the middleware is mounted
});

const app = express();
app.use('/filekit', createFileKitMiddleware(filekit));   // FileKit's routes — before body parsers

// Your routes decide who may upload, and store the result
app.post('/api/uploads', auth, express.json(), async (req, res) => {
  res.json(await filekit.createUpload(req.body, { subject: req.user.id }));
});
app.post('/api/uploads/complete', auth, express.json(), async (req, res) => {
  const file = await filekit.completeUpload(req.body.ticket, { parts: req.body.parts, subject: req.user.id });
  res.json(await db.files.insert({ ownerId: req.user.id, ...file }));
});
app.get('/api/files/:id/url', auth, async (req, res) => {
  const row = await db.files.findOwned(req.params.id, req.user.id);
  res.json(await filekit.getUrl(row, { downloadAs: row.originalName }));   // { url, access, expiresAt? }
});

// Server-side upload (no URL)
await filekit.upload(pdfBuffer, { filename: 'invoice.pdf', folder: 'invoices' });

NestJS: FileKitModule.forRootAsync({ useFactory: () => ({ …options, routes: { path: 'filekit' } }) }) and inject with @InjectFileKit() — see the guide §3.2.

Functions at a glance

| Task | Function | Guide | |---|---|---| | Start a browser upload (single / multipart) | createUpload(request, options?) · createUploads(requests, options?) | §11.1–11.2 | | Refresh multipart part URLs | getPartUrls(ticket, partNumbers) | §11.3 | | Finish and verify an upload | completeUpload(ticket, options?) · completeUploads(items, options?) | §11.4–11.5 | | Cancel an upload | abortUpload(ticket, options?) | §11.6 | | Upload bytes the server has | upload(body, request) · uploadMany(items, options?) | §11.7–11.8 | | Download link (public or signed) | getUrl(ref, options?) · getUrls(refs, options?) | §12.1–12.2 | | Read a file on the server | download(ref, { range? }) · downloadBuffer(ref) · head(ref) · exists(ref) | §12.3–12.5 | | Stream a file from your own route | sendFile(filekit, req, res, ref, options?) | §12.6 | | Thumbnails / resized copies | getUrl(ref, { variant }) · variant(ref, name) · variantKey(ref, name) · sendFile(…, { variant }) | §6.1, §12.7 | | Delete / copy / move / list | delete · deleteMany · copy · move · list · sweepStaging | §13 | | Scoped S3 credentials, adopt a file | issueUploadCredentials(options) · verifyUploaded(ref, options?) | §14 | | Policy, settings, info | validate · getPolicy · getProviderSettings · accessFor · describeProviders · on · init · close | §15 | | Mount in a framework | createFileKitMiddleware · createHandler · FileKitModule · createFileServer · fileKitOptionsFromEnv | §16, §8.4, §10 |

Entry points

| Import | Contents | |---|---| | @antzsoft/filekit-server | createFileKit, FileKit, createHandler, createFileKitMiddleware, sendFile, memoryUrlCache, FileKitError, isFileKitError, all types | | @antzsoft/filekit-server/s3 | s3() | | @antzsoft/filekit-server/azure | azure() | | @antzsoft/filekit-server/local | local() | | @antzsoft/filekit-server/remote | remote(), createFileServer() | | @antzsoft/filekit-server/sftp | sftp() | | @antzsoft/filekit-server/ftp | ftp() | | @antzsoft/filekit-server/express | createFileKitMiddleware() | | @antzsoft/filekit-server/nest | FileKitModule, InjectFileKit, FILEKIT | | @antzsoft/filekit-server/env | fileKitOptionsFromEnv() | | @antzsoft/filekit-server/images | sharpTransformer() (needs sharp) |

What each storage supports

| | s3 | azure | remote | local | sftp | ftp | |---|---|---|---|---|---|---| | Direct upload / signed link from storage | ✅ | ✅ | ✅ | — | — | — | | Proxied upload / signed link through FileKit | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | | Public links | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | | Multipart (large files) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | | Server-side upload, stream, buffer | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | | Scoped credentials | ✅ | — | — | — | — | — | | Image variants | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |

Documentation

  • INTEGRATION.md (HTML) — Part A: quick start and recipes · Parts B–E: every option, function, route, type, event and error.
  • @antzsoft/filekit-core — the shared protocol, policy engine and helpers (for front ends and client SDKs).
  • In the FileKit workspace: DESIGN.md (decisions) and examples/ (Express, NestJS, file server, browser playground, end-to-end tests).

Registry

.npmrc points the @antzsoft scope at the local Verdaccio registry (http://localhost:4873). Remove that line to use npmjs.