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 🙏

© 2024 – Pkg Stats / Ryan Hefner

tus-standalone-server

v0.0.16

Published

extends tus-node-server

Downloads

10

Readme

tus-standalone-server

NPM Version NPM Downloads Node.js Version License - MIT

This library encapsulates the standalone server of tus-node-server, provides parameters to create a separate file upload server for you, and has TusRegister records

Default config:

{
    host: "127.0.0.1",
    port: 1080,
    path: "/files",
    options: {
        isRandomFileName: true, 
        splitFileByMIMEType: "type", 
        splitFileByFunctionality: null,
        filePathToSave: './uploads',
    }
 }  
  • isRandomFileName: If it is set to false, it will not allow the upload of files with the same name even if the content of the file is different.
  • splitFileByMIMEType: Sort the files into their respective folders according to their MIME Type.
  • splitFileByFunctionality: Sort the files into their respective folders according to their functions.

Example

import {TusStandalone, TusRegister} from "tus-standalone-server"

let TusServer1 = new TusStandalone();
let TusServer2 = new TusStandalone({port: 3000});
let TusServer3 = new TusStandalone({ host: "127.0.0.1", port: 3333, path: "/ttttt", options: { splitFileByMIMEType: null } });
let TusServer4 = new TusStandalone({ options: { isSavingFileToTemp: true, splitFileByFunctionality: "ad", splitFileByMIMEType:null } });

console.log(TusRegister):

/** read only */
_TusRegister {
  /** What is the smallest port used randomly when the port is occupied */
  portRangeMin: 1, 
  /** What is the biggest port used randomly when the port is occupied */
  portRangeMax: 65534, 
  /** Upon using detect-port to check, it was discovered that the port is already in use. */
  OccupiedPortSet: Set(2) { 1080, 3333 },
  /** The port that is occupied after the server successfully starts. */
  ServePortSet: Set(4) { 1080, 3000, 56832, 15657 },
  ServerMap: Map(4) {
    'http://127.0.0.1:1080/files' => TusServer {
      _events: [Object: null prototype],
      _eventsCount: 3,
      _maxListeners: undefined,
      options: [Object],
      handlers: [Object],
      _datastore: [FileStore],
      [Symbol(kCapture)]: false
    },
    'http://127.0.0.1:3000/files' => TusServer {...},
    'http://127.0.0.1:56832/files' => TusServer {...},
    'http://127.0.0.1:15657/ttttt' => TusServer {...}
  }
}

Features

GET handler

  • http://<HOST>:<PORT>/uploads-list
    You can view the list of all uploaded files through this URL, even though different servers still point to the same storage space.
    // 20230129185413
    // http://127.0.0.1:1080/uploads-list
      
      {
          "file_struct": {
              "_files": [
                  "aMVrBeut-3PJNz-m7gb3-9QTiY-2KKPQV9vS.jpg",
                  "yN3zPwDk-yzQJ0-8MIEu-0reBS-6T05YKbGt.pdf"
              ],
              "ad": {
                  "_files": [
                      "sAo1DGYc-BH0GU-hU59p-zQ8Oz-RzsYuvIlG.mp4"
                  ]
              },
              "application": {
                  "_files": [
                      "0a7985a0-570f-4c9d-a287-0a4feac813e2.pdf"
                  ]
              },
              "image": {
                  "_files": [
                      "431bf697-a55a-469d-bd2a-11ea85e2f573.gif"
                  ]
              },
              "temp": {
                  "_files": [ ]
              },
              "video": {
                  "_files": [
                      "a1ad7ad0-7c79-4e64-bbae-5976fb5ce7bc.mp4"
                  ]
              }
          },
          "full_path": {
              "_files": [
                  "C:\\Users\\User\\Documents\\work\\uploads\\ad\\sAo1DGYc-BH0GU-hU59p-zQ8Oz-RzsYuvIlG.mp4",
                  "C:\\Users\\User\\Documents\\work\\uploads\\aMVrBeut-3PJNz-m7gb3-9QTiY-2KKPQV9vS.jpg",
                  "C:\\Users\\User\\Documents\\work\\uploads\\application\\0a7985a0-570f-4c9d-a287-0a4feac813e2.pdf",
                  "C:\\Users\\User\\Documents\\work\\uploads\\image\\431bf697-a55a-469d-bd2a-11ea85e2f573.gif",
                  "C:\\Users\\User\\Documents\\work\\uploads\\video\\a1ad7ad0-7c79-4e64-bbae-5976fb5ce7bc.mp4",
                  "C:\\Users\\User\\Documents\\work\\uploads\\yN3zPwDk-yzQJ0-8MIEu-0reBS-6T05YKbGt.pdf"
              ],
              "sAo1DGYc-BH0GU-hU59p-zQ8Oz-RzsYuvIlG.mp4": "C:\\Users\\User\\Documents\\work\\uploads\\ad\\sAo1DGYc-BH0GU-hU59p-zQ8Oz-RzsYuvIlG.mp4",
              "aMVrBeut-3PJNz-m7gb3-9QTiY-2KKPQV9vS.jpg": "C:\\Users\\User\\Documents\\work\\uploads\\aMVrBeut-3PJNz-m7gb3-9QTiY-2KKPQV9vS.jpg",
              "0a7985a0-570f-4c9d-a287-0a4feac813e2.pdf": "C:\\Users\\User\\Documents\\work\\uploads\\application\\0a7985a0-570f-4c9d-a287-0a4feac813e2.pdf",
              "431bf697-a55a-469d-bd2a-11ea85e2f573.gif": "C:\\Users\\User\\Documents\\work\\uploads\\image\\431bf697-a55a-469d-bd2a-11ea85e2f573.gif",
              "a1ad7ad0-7c79-4e64-bbae-5976fb5ce7bc.mp4": "C:\\Users\\User\\Documents\\work\\uploads\\video\\a1ad7ad0-7c79-4e64-bbae-5976fb5ce7bc.mp4",
              "yN3zPwDk-yzQJ0-8MIEu-0reBS-6T05YKbGt.pdf": "C:\\Users\\User\\Documents\\work\\uploads\\yN3zPwDk-yzQJ0-8MIEu-0reBS-6T05YKbGt.pdf"
          }
      }
  • http://<HOST>:<PORT>/files/<FILENAME>
    You can download the uploaded files according to the file name through this URL