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

adonis-drive-minio

v0.0.8

Published

Minio Driver for Adonis Drive

Downloads

152

Readme

adonis-drive-minio 💾

npm version npm npm

Minio driver for AdonisJS Drive

Requirements

Installation

adonis install adonis-drive-minio

Instructions

Make sure to register the provider inside start/app.js file.

const providers = [
  ...
  'adonis-drive-minio/providers/DriveProvider'
]

Add new configuration inside disks module in config/drive.js:

minio: {
  driver: 'minio',
  host: Env.get('MINIO_HOST'),
  port: Env.get('MINIO_PORT'),
  secure: Env.get('MINIO_SECURE'),
  accessKey: Env.get('MINIO_ACCESS'),
  secretKey: Env.get('MINIO_SECRET'),
  bucket: Env.get('MINIO_BUCKET'),
  region: Env.get('MINIO_REGION')
}

Add minio variables in .env file:

MINIO_HOST=
MINIO_PORT=
MINIO_SECURE=
MINIO_ACCESS=
MINIO_SECRET=
MINIO_BUCKET=
MINIO_REGION=

Examples

exists(relativePath) -> Boolean

Find if a file exists or not.

const isExists = await Drive.disk('minio').exists('adonis.jpeg')

get(relativePath, outputPath) -> String

Downloads and saves the object as a file in the local filesystem.

const path = await Drive.disk('minio').get('adonis.jpeg', Helpers.tmpPath('adonis.jpeg'))

getUrl(relativePath, bucket?) -> String

Returns url for a given key. Note this method doesn't validates the existence of file or it's visibility status.

const url = await Drive.disk('minio').getUrl('adonis.jpeg')

getSignedUrl(relativePath, expiry?) -> String

Presigned URLs are generated for temporary download/upload access to private objects.

// url is valid for 10 minutes
const url = await Drive.disk('minio').getSignedUrl
('adonis.jpeg')

// url is valid for one hour
const url = await Drive.disk('minio').getSignedUrl
('adonis.jpeg', 3600)

put(filePath, relativePath?) -> String

Create a new file.

// url = bucketname/adonis.jpeg
const url = await Drive.disk('minio').put('/home/pictures/adonis.jpeg')

// url = bucketname/uploaded.jpeg
const url = await Drive.disk('minio').put('/home/pictures/adonis.jpeg', 'uploaded.jpeg')

delete(relativePath) -> Boolean

Remove a file.

const isDeleted = await Drive.disk('minio').delete('adonis.jpeg')

copy(src, dest, destBucket?) -> String

Copy file from one location to another within.

// copied in the same bucket
const url = await Drive.disk('minio').copy('adonis.jpeg', 'adonis-2.jpeg')

// copied to "other-bucket" bucket
const url = await Drive.disk('minio').copy('adonis.jpeg', 'adonis-2.jpeg', 'other-bucket')

move(src, dest, destBucket?) -> String

Move file from one location to another within.

// moved in the same bucket
const url = await Drive.disk('minio').move('adonis.jpeg', 'new-adonis.jpeg')

// moved to "other-bucket" bucket
const url = await Drive.disk('minio').move('adonis.jpeg', 'adonis-2.jpeg', 'other-bucket')

Change bucket

You can change bucket at runtime, just passing the bucket name before action.

const isExists = await Drive.disk('minio').bucket('new-bucket').exists('adonis.jpeg')

Thanks

Special thanks to the creator(s) of AdonisJS for creating such a great framework.