-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3ab0f58
commit eb1abb2
Showing
2 changed files
with
35 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,22 @@ | ||
const fs = require('fs/promises') | ||
const CyclicS3FSPromises = require('./CyclicS3FSPromises') | ||
// const client = function(bucketName, config={}){ | ||
// if(!process.env.AWS_SECRET_ACCESS_KEY){ | ||
// console.warn('[s3fs] WARNING: AWS credentials are not set. Using local file system') | ||
// return fs | ||
// } | ||
// return new CyclicS3FSPromises(bucketName, config) | ||
// } | ||
var client = new CyclicS3FSPromises() | ||
class FSPromisesFallback extends Function{ | ||
constructor() { | ||
super('...args', 'return this._bound._call(...args)') | ||
this._bound = this.bind(this) | ||
Object.assign(this._bound,{...fs}) | ||
return this._bound | ||
} | ||
_call() { | ||
let client = new FSPromisesFallback() | ||
return client | ||
} | ||
} | ||
|
||
// module.exports = client | ||
module.exports = new CyclicS3FSPromises() | ||
if(!process.env.AWS_SECRET_ACCESS_KEY){ | ||
console.warn('[s3fs] WARNING: AWS credentials are not set. Using local file system') | ||
client = new FSPromisesFallback() | ||
} | ||
|
||
module.exports = client |