{"_id":"@catalogworks/filebase-storage-js","name":"@catalogworks/filebase-storage-js","dist-tags":{"latest":"0.1.6"},"versions":{"0.1.6":{"name":"@catalogworks/filebase-storage-js","version":"0.1.6","description":"JS SDK to interact with Filebase","main":"index.js","scripts":{"test":"jest","lint":"eslint \"**/*.{js,ts}\"","lint:fix":"eslint --fix \"**/*.{js,ts}\"","format":"prettier --check \"**/*.{ts,js}\"","format:fix":"prettier --write \"**/*.{ts,js}\""},"repository":{"type":"git","url":"git+https://github.com/catalogworks/filebase-storage-js.git"},"publishConfig":{"registry":"https://registry.npmjs.org/"},"author":{"name":"@catalogworks"},"license":"MIT","devDependencies":{"eslint":"^7.2.0","eslint-config-prettier":"^8.3.0","jest":"^26.0.1","prettier":"^2.5.1"},"dependencies":{"aws-sdk":"^2.989.0","axios":"^0.21.1","multiformats":"^9.4.7","s3-streaming-upload":"^0.3.4"},"types":"./index.d.ts","gitHead":"af5a09f8f4add9874dab72c29c5928346ff0ca49","bugs":{"url":"https://github.com/catalogworks/filebase-storage-js/issues"},"homepage":"https://github.com/catalogworks/filebase-storage-js#readme","_id":"@catalogworks/filebase-storage-js@0.1.6","_nodeVersion":"17.5.0","_npmVersion":"8.4.1","dist":{"integrity":"sha512-f60CWSy5PoN712+DL5+19jtBKh/2opn15sVQd4hXOm21/WpWgUi6QAO4n7HcD2W4F0vdjmE8H25iRrAfAc8Qig==","shasum":"b10bc6b72e36b6bf5cc6d906751ca73480ce44c1","tarball":"https://registry.npmjs.org/@catalogworks/filebase-storage-js/-/filebase-storage-js-0.1.6.tgz","fileCount":40,"unpackedSize":36657,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIEVHIZH1qNub41wQCdmfQOmWjDdw6FGR/dMBhb4fOXRkAiEA+WIOzDynkrIwpIoZS/Z8F+bY2dq29aqKOS1EFlU0jSY="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjqD3aACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqTPRAAhaSB4UeTdWZZn5PFnHBMh2/t8nt2CQ24ZahGjFUcC5zBkt8O\r\nikoJaZ4w1dXBBk8CB0HQNCbPt9mZrSpwWxixP0Z6bgnb8mWInsoIeSO5aqjM\r\ns8CftjKQKv71Pr+qOsjq5mt55Kbuyg3Hj3Q1IANKaiFgVgi5DPuolpzd+ahV\r\n0Ib0Ri8+QkToMUxxSO9uSzqfSNxruBa/hCgwLJpeayU7SHWuLfSTx4nn8K4N\r\nEL/6Ms+ygT3+GhXZXeEetTKnskvoqCR/w3WslZKEq025n4Xm2PNJBmDqFpBA\r\nagJQY/st/4qF5TF98/7LcehwPVn3Po1o6qilfeQsMR26RrkCrqkpeBHddK9p\r\nY1Anpc8IFNv8yl9XZMBlCotVJ65qzBJFfuRFVVvHjgcLC7g4yVAYFEVIo2DL\r\ndryx/5UFP2c14fJnk3ODM6xWBVI4kKTJXhGLlFIr4skJJXXiqcx/poyG5lLs\r\nKUgJrX6vSXmO0mYX4sL2SysCSDCCoAVU8UkCZVJDn/DL7L67H3xrV2flDfjC\r\nA/hIKf7DkxHDSW+hrv8hcRVrVvtqXhtvra2HIgDlqVLLDvw9Wygtp7UPoWrP\r\n8hSlm3o4YuAxuL7nwPGegPzB5R3po9115Ds9cAQraJB+mCS6ICMvHqC0iYwp\r\ny0ceBZcpErwCJMGkGAXUFYI3qYv59NefeU4=\r\n=mnrQ\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"bretth18","email":"bretth18@gmail.com"},"directories":{},"maintainers":[{"name":"reefloretto","email":"r@catalog.works"},{"name":"bretth18","email":"bretth18@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/filebase-storage-js_0.1.6_1671970266286_0.6811844736697894"},"_hasShrinkwrap":false}},"time":{"created":"2022-12-25T12:11:06.208Z","0.1.6":"2022-12-25T12:11:06.419Z","modified":"2022-12-25T12:11:06.604Z"},"maintainers":[{"name":"reefloretto","email":"r@catalog.works"},{"name":"bretth18","email":"bretth18@gmail.com"}],"description":"JS SDK to interact with Filebase","homepage":"https://github.com/catalogworks/filebase-storage-js#readme","repository":{"type":"git","url":"git+https://github.com/catalogworks/filebase-storage-js.git"},"author":{"name":"@catalogworks"},"bugs":{"url":"https://github.com/catalogworks/filebase-storage-js/issues"},"license":"MIT","readme":"# Filebase Storage JS\n\nseems familiar...\nFilebase Storage Js is an SDK to interact with Filebase Storage.\n\n# Methods\n\n## get\n\nThe `get` method is for fetching individual files, either the content or related data, such as the key, hash and publicUrl.\n\nExample of usage:\n\n```\nconst myFile = await filebaseStorage.get({\n  apiKey: 'my-key',\n  apiSecret: 'my-secret',\n  key: 'my-file-key',\n  getOptions: [\n    'data',\n    'bucket',\n    'key',\n    'hash',\n    'publicUrl'\n  ],\n})\n```\n\n### Input parameters of get\n\n|      param | type                                                     | description                                                                                                                                                       |\n| ---------: | -------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n|     apiKey | String                                                   | The api key used for authentication                                                                                                                               |\n|  apiSecret | String                                                   | The api secret used for authentication                                                                                                                            |\n|        key | String                                                   | The key identifying the requested file in the bucket                                                                                                              |\n|     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 Filebase account                                                            |\n| 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` |\n\n## upload\n\nThe `upload` method uploads a file, identified by a key, to a bucket.\nThe function returns the hash of the file, the publicUrl, the key and the bucket.\n\nExample of usage:\n\n```\nfs.readFile(filePath, async (error, fileData) => {\n  const uploadedFile = await filebaseStorage.upload({\n    apiKey: 'my-key',\n    apiSecret: 'my-secret',\n    key: 'my-file-key',\n    data: fileData,\n  });\n})\n\n\n```\n\n### Input parameters of upload\n\n|     param | type                                                     | description                                                                                            |\n| --------: | -------------------------------------------------------- | ------------------------------------------------------------------------------------------------------ |\n|    apiKey | String                                                   | The api key used for authentication                                                                    |\n| apiSecret | String                                                   | The api secret used for authentication                                                                 |\n|       key | String                                                   | The key identifying the requested file in the bucket                                                   |\n|    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 Filebase account |\n|      data | Any                                                      | The data of the file to be uploaded                                                                    |\n\n## deleteFile\n\nThe `deleteFile` method deletes a file, identified by its key and bucket.\nThe function returns the key and bucket of the deleted file if successful.\nIf the file does not exist, the method will still execute successfully.\n\nExample of usage:\n\n```\n  await filebaseStorage.deleteFile({\n    apiKey: 'my-key',\n    apiSecret: 'my-secret',\n    key: 'my-file-key',\n    bucket: 'my-bucket',\n  });\n\n```\n\n### Input parameters of deleteFile\n\n|     param | type                                                     | description                                                                                            |\n| --------: | -------------------------------------------------------- | ------------------------------------------------------------------------------------------------------ |\n|    apiKey | String                                                   | The api key used for authentication                                                                    |\n| apiSecret | String                                                   | The api secret used for authentication                                                                 |\n|       key | String                                                   | The key identifying the file in the bucket                                                             |\n|    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 Filebase account |\n\n## listFiles\n\nThe `listFiles` method is for fetching information about all files in a bucket such as the key, hash and publicUrl.\n\nExample of usage:\n\n```\nconst files = await filebaseStorage.listFiles({\n  apiKey: 'my-key',\n  apiSecret: 'my-secret',\n  prefix: 'my-folder',\n  getOptions: [\n    'bucket',\n    'key',\n    'hash',\n    'publicUrl'\n  ],\n})\n```\n\n### Input parameters of listFiles\n\n|      param | type                                                        | description                                                                                                                                               |\n| ---------: | ----------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- |\n|     apiKey | String                                                      | The api key used for authentication                                                                                                                       |\n|  apiSecret | String                                                      | The api secret used for authentication                                                                                                                    |\n|     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 Filebasa account                                                    |\n|     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 Filebase Storage                                 |\n| 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` |\n\n## listBuckets\n\nThe `listBuckets` method returns an array of bucket names associated with the api key's account.\n\nExample of usage:\n\n```\nconst buckets = await filebaseStorage.listBuckets({\n  apiKey: 'my-key',\n  apiSecret: 'my-secret',\n})\n```\n\n### Input parameters of listBuckets\n\n|     param | type   | description                            |\n| --------: | ------ | -------------------------------------- |\n|    apiKey | String | The api key used for authentication    |\n| apiSecret | String | The api secret used for authentication |\n\n## getFileFromHash\n\n`getFileFromHash` is a utility function that downloads a file's data from Filebase's IPFS gateway using the hash. The key and secret is not required since the gateway is publicly available.\n\nExample of usage:\n\n```\nconst myFile = await filebaseStorage.getFileFromHash({\n  hash: 'bafybeige4bhzjvrptn7fdz7mqgigzoczcliqpuo7km4jm7vgjg2pbmuhna',\n  getFileFromHashOptions: [\n    'buffer',\n  ],\n})\n```\n\n### Input parameters of getFileFromHash\n\n|                  param | type                            | description                                                                                                                                                                       |\n| ---------------------: | ------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n|                   hash | String                          | The hash of the requested file                                                                                                                                                    |\n| 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) |\n","readmeFilename":"README.md"}