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 🙏

© 2025 – Pkg Stats / Ryan Hefner

file-browser-nodejs

v1.0.0

Published

A Node.js SDK for interacting with the File Browser API, supporting authentication, file upload, and file management.

Readme

File Browser SDK

A simple Node.js SDK for interacting with the File Browser API. This SDK supports authentication, folder management, file uploading, and other file management functionalities.

Note: This SDK is unofficial and is not officially maintained by the File Browser project. Additionally, this SDK is currently under development and should not be used in production. It may have bugs and incomplete features.

Features

  • Log in using a username and password to get an authentication token.
  • Create and delete folders.
  • Upload files to specific folders with name support.
  • Rename files.
  • Get sharable links for files.
  • Easy integration with your Node.js projects.

Installation

You can install this SDK via npm:

npm install file-browser-nodejs

Usage

1. Initialize the SDK

First, import and initialize the FileBrowserSDK class. You will need to provide the base API URL for your File Browser instance.

const FileBrowserSDK = require("file-browser-nodejs");

const sdk = new FileBrowserSDK("http://your-file-browser-instance.com"); // Replace with your File Browser URL

2. Authentication

To authenticate and get an authentication token, use the authenticate method. This method requires a username and password.

const username = "your_username"; // Replace with your username
const password = "your_password"; // Replace with your password

sdk
  .authenticate(username, password)
  .then(() => {
    console.log("Authenticated successfully");
  })
  .catch((err) => {
    console.error("Authentication failed:", err);
  });

3. Create a Folder

To create a folder, use the createFolder method. You need to provide the folder path where the folder should be created.

const folderPath = "path/to/folder";

sdk
  .createFolder(folderPath)
  .then((data) => {
    console.log("Folder created:", data);
  })
  .catch((err) => {
    console.error("Error creating folder:", err);
  });

4. Delete a Folder

To delete a folder, use the deleteFolder method. Provide the path of the folder to be deleted.

const folderPath = "path/to/folder";

sdk
  .deleteFolder(folderPath)
  .then(() => {
    console.log("Folder deleted successfully");
  })
  .catch((err) => {
    console.error("Error deleting folder:", err);
  });

5. Uploading a File

To upload a file, you need to provide the file's path and the destination folder path. The SDK handles file uploads by chunking and performing all necessary HTTP requests.

const filePath = "path/to/your/file"; // Path to the file you want to upload
const folderPath = "destination/folder"; // Destination folder path

sdk
  .uploadFile(filePath, folderPath)
  .then((response) => {
    console.log("File uploaded successfully:", response);
  })
  .catch((err) => {
    console.error("Upload failed:", err);
  });

6. Rename a File

To rename a file, use the renameFile method. Provide the current file name and the new file name, along with the folder path.

const folderPath = "path/to/folder";
const currentFileName = "old_file.txt";
const newFileName = "new_file.txt";

sdk
  .renameFile(folderPath, currentFileName, newFileName)
  .then((response) => {
    console.log("File renamed successfully:", response);
  })
  .catch((err) => {
    console.error("Error renaming file:", err);
  });

7. Get Sharable Link for a File

To generate a sharable link for a file, use the getSharableLink method. Provide the file path for which you want to generate the link.

const filePath = "path/to/your/file";

sdk
  .getSharableLink(filePath)
  .then((linkData) => {
    if (linkData) {
      console.log("Sharable link generated:", linkData.url);
      console.log("Download link:", linkData.downloadLink);
    } else {
      console.log("No sharable link available.");
    }
  })
  .catch((err) => {
    console.error("Error generating sharable link:", err);
  });

8. Get File Details

To fetch details of a specific file or folder, use the getFileDetails method. Provide the file or folder path.

const filePath = "path/to/your/file";

sdk
  .getFileDetails(filePath)
  .then((details) => {
    console.log("File details:", details);
  })
  .catch((err) => {
    console.error("Error fetching file details:", err);
  });

9. Get Files in a Folder

To list the files or folders in a specific folder, use the getFilesInFolder method. Provide the folder path.

const folderPath = "path/to/folder";

sdk
  .getFilesInFolder(folderPath)
  .then((files) => {
    console.log("Files in folder:", files);
  })
  .catch((err) => {
    console.error("Error fetching files:", err);
  });

Contributing

We welcome contributions to this project. If you want to help, please fork the repository and submit a pull request.

  1. Fork the repo.
  2. Create a new branch for your feature or bug fix.
  3. Make changes and commit them.
  4. Push your branch and create a pull request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Support

For any questions or issues, please open an issue on GitHub.