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

s3b

v1.2.0

Published

A Self Hosted S3 Bucket

Downloads

112

Readme

s3b

s3b is a powerful and user-friendly client designed to interact with the s3b-server, a self-hosted S3-compatible storage solution. This client facilitates seamless communication with the server, enabling efficient data storage, retrieval, and management within self-hosted S3 buckets. With an intuitive interface and robust functionality, s3b simplifies the process of handling S3 operations, making it an ideal tool for developers and organizations utilizing self-hosted S3 storage systems.

Installation

Install the s3b package

npm install s3b

For s3b-server Installation go through this docs.

Usage

First of all make a config file for s3b & export bucket instance from it.

// s3b.config.js

import { Bucket } from 's3b'

const bucket = new Bucket({
    baseURL: 'YOUR_s3b-server_HOST_NAME', // Ex: https://cdn.example.com
    bucketId: 'YOUR_BUCKET_ID',
    apiKey: 'YOUR_API_KEY',
    apiSecret: 'YOUR_API_SECRET_KEY',
})

export {bucket}

Now bucket instance can be used wherever it needed. Suppose, here we are using it to store user avatar, in user controller of your express app.

// user.controller.js

import { bucket } from '/path/to/s3b.config.js'

...
const avatar = req.file
const downloadUrl = await bucket.uploadFile('/user/avatar/user-1.png', avatar)
...

Other Bucket Methods

| Method | Params | Description | | -------------- | ----------------------- | ---------------------------------------- | | uploadFile | filePath, file | filePath is the final destination of file on the server with file name (path/to/file/avt-user-9877.png). And the file is the file object got from multer.| | uploadManyFile | dirPath, files | dirPath is the target dir on server. files are file objects same as uploadFile. | | deleteFile | downloadUrl | URL of the target file | | isExist | downloadUrl | URL of the target file | | Copy | source, destination | Both path are relative path from bucket | | Move | source, destination | Both path are relative path from bucket | | readDir | dir | Target directory path to list all files & dirs. | | makeDir | dir | Create new directory recursively |

Contributing

Thank you for investing your time in contributing to our project! Whether it's a bug report, new feature, correction, or additional documentation, we greatly value feedback and contributions from our community. Any contribution you make will be reflected on github.com/CodingSamrat/s3b.

Contributions to s3b are welcome! Here's how to get started:

  • Open an issue or find for related issues to start a discussion around a feature idea or a bug.
  • Fork the repository on GitHub.
  • Create a new branch of the master branch and start making your changes.
  • Make a meaning-full commit.
  • Write a test, which shows that the bug is fixed or the feature works as expected.
  • Send a pull request and wait until it gets merged and published.