Research
Security News
Kill Switch Hidden in npm Packages Typosquatting Chalk and Chokidar
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
@fleekhq/fleek-storage-js
Advanced tools
Fleek Storage Js is an SDK to interact with Fleek Storage.
:exclamation: Please do not use this package directly in the browser. Your API secret will be visible to users of that page. If you need to make requests from the client side, please use an S3 SDK directly with pre-signed urls: https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-presigned-url.html.
yarn add @fleekhq/fleek-storage-js
The SDK can be imported using an import
statement.
import fleekStorage from '@fleekhq/fleek-storage-js'
The SDK can also be imported using a require
.
const fleekStorage = require('@fleekhq/fleek-storage-js')
The api key and secret can be generated on the Fleek Web app or from the Fleek CLI.
The get
method is for fetching individual files, either the content or related data, such as the key, hash and publicUrl.
Example of usage:
const myFile = await fleekStorage.get({
apiKey: 'my-key',
apiSecret: 'my-secret',
key: 'my-file-key',
getOptions: [
'data',
'bucket',
'key',
'hash',
'publicUrl'
],
})
param | type | description |
---|---|---|
apiKey | String | The api key used for authentication |
apiSecret | String | The api secret used for authentication |
key | String | The key identifying the requested file in the bucket |
bucket | String, optional, defaults to the default account bucket | The name of the bucket containing the file. A bucket is created by default with every Fleek account |
getOptions | Array, optional, defaults to ['data'] | An array specifying what type of information to retrieve concerning the file. Possible values for the array includes data , bucket , hash , key , publicUrl |
The upload
method uploads a file, identified by a key, to a bucket.
The function returns the hash of the file, the publicUrl, the key and the bucket.
Example of usage:
fs.readFile(filePath, async (error, fileData) => {
const uploadedFile = await fleekStorage.upload({
apiKey: 'my-key',
apiSecret: 'my-secret',
key: 'my-file-key',
data: fileData,
});
})
param | type | description |
---|---|---|
apiKey | String | The api key used for authentication |
apiSecret | String | The api secret used for authentication |
key | String | The key identifying the requested file in the bucket |
bucket | String, optional, defaults to the default account bucket | The name of the bucket containing the file. A bucket is created by default with every Fleek account |
data | Any | The data of the file to be uploaded |
The deleteFile
method deletes a file, identified by its key and bucket.
The function returns the key and bucket of the deleted file if successful.
If the file does not exist, the method will still execute successfully.
Example of usage:
await fleekStorage.deleteFile({
apiKey: 'my-key',
apiSecret: 'my-secret',
key: 'my-file-key',
bucket: 'my-bucket',
});
param | type | description |
---|---|---|
apiKey | String | The api key used for authentication |
apiSecret | String | The api secret used for authentication |
key | String | The key identifying the file in the bucket |
bucket | String, optional, defaults to the default account bucket | The name of the bucket containing the file. A bucket is created by default with every Fleek account |
The listFiles
method is for fetching information about all files in a bucket such as the key, hash and publicUrl.
Example of usage:
const files = await fleekStorage.listFiles({
apiKey: 'my-key',
apiSecret: 'my-secret',
prefix: 'my-folder',
getOptions: [
'bucket',
'key',
'hash',
'publicUrl'
],
})
param | type | description |
---|---|---|
apiKey | String | The api key used for authentication |
apiSecret | String | The api secret used for authentication |
bucket | String, optional, defaults to the default account bucket | The name of the bucket containing the file. A bucket is created by default with every Fleek account |
prefix | String, optional, defaults to the empty string | The name of the folder you want to list files in. Can be used to recurse through the folder structure in Fleek Storage |
getOptions | Array, optional, defaults to ['key', 'bucket', 'publicUrl'] | An array specifying what type of information to retrieve concerning the file. Possible values for the array includes bucket , hash , key , publicUrl |
The listBuckets
method returns an array of bucket names associated with the api key's account.
Example of usage:
const buckets = await fleekStorage.listBuckets({
apiKey: 'my-key',
apiSecret: 'my-secret',
})
param | type | description |
---|---|---|
apiKey | String | The api key used for authentication |
apiSecret | String | The api secret used for authentication |
getFileFromHash
is a utility function that downloads a file's data from Fleek's IPFS gateway using the hash. The key and secret is not required since the gateway is publicly available.
Example of usage:
const myFile = await fleekStorage.getFileFromHash({
hash: 'bafybeige4bhzjvrptn7fdz7mqgigzoczcliqpuo7km4jm7vgjg2pbmuhna',
getFileFromHashOptions: [
'buffer',
],
})
param | type | description |
---|---|---|
hash | String | The hash of the requested file |
getFileFromHashOptions | Array, optional, defaults to [] | An array specifying additional options when it comes to fetching by hash. Possible values for the array includes buffer (this returns the whole file at once instead of chunks) |
FAQs
JS SDK to interact with Fleek Storage
The npm package @fleekhq/fleek-storage-js receives a total of 19,304 weekly downloads. As such, @fleekhq/fleek-storage-js popularity was classified as popular.
We found that @fleekhq/fleek-storage-js demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 5 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.