17. August 2021
Drive arriving and minor updates
Drive is arriving
@adonisjs/drive is coming together to be used with AdonisJS v5
It seems to already in usable state, but documentation is still missing. We can expect docs for it to arrive in a week or two. Ofcourse it wouldn’t be too good idea to use it in production just yet, better to wait until official release.
With new version Drive is taken out from Core of the framework and it’s standalone module, like @adonisjs/view and @adonisjs/lucid etc
Currently drive supports three kinds of storage: local filesystem, DigitalOcean spaces and S3 buckets (includes everything that has same API with S3 eg Vultr or LiquidWeb Object-Storage)
Drive signature:
NOTICE! It might change slightly before first stable release
/**
* A boolean to find if the location path exists or not
*/
exists(location: string): Promise<boolean>
/**
* Returns the file contents as a buffer.
*/
get(location: string): Promise<Buffer>
/**
* Returns the file contents as a stream
*/
getStream(location: string): Promise<NodeJS.ReadableStream>
/**
* Returns the location path visibility
*/
getVisibility(location: string): Promise<Visibility>
/**
* Returns the location path stats
*/
getStats(location: string): Promise<DriveFileStats>
/**
* Returns a signed URL for a given location path
*/
getSignedUrl(
location: string,
options?: ContentHeaders & { expiresIn?: string | number }
): Promise<string>
/**
* Returns a URL for a given location path
*/
getUrl(location: string): Promise<string>
/**
* Write string|buffer contents to a destination. The missing
* intermediate directories will be created (if required).
*/
put(location: string, contents: Buffer | string, options?: WriteOptions): Promise<void>
/**
* Write a stream to a destination. The missing intermediate
* directories will be created (if required).
*/
putStream(
location: string,
contents: NodeJS.ReadableStream,
options?: WriteOptions
): Promise<void>
/**
* Update the visibility of the file
*
* Visibility decides if the files from this disk are publicly accessible
* or not. When set to "private" the files will be accessible only using
* a signed URL
*/
setVisibility(location: string, visibility: Visibility): Promise<void>
/**
* Remove a given location path
*/
delete(location: string): Promise<void>
/**
* Copy a given location path from the source to the desination.
* The missing intermediate directories will be created (if required)
*/
copy(source: string, destination: string, options?: WriteOptions): Promise<void>
/**
* Move a given location path from the source to the desination.
* The missing intermediate directories will be created (if required)
*/
move(source: string, destination: string, options?: WriteOptions): Promise<void>
Other smaller updates
Validator got some date related error messages fixed and better DateTime detection
Both validator and http-server got updates to their peer dependency versions