# JavaScript utility libraries

The Web3.Storage JavaScript client library provides a simple interface for interacting with Web3.Storage. This page highlights some additional libraries that may be helpful when working with the client library, or when using the HTTP API (opens new window) directly.

# files-from-path

The files-from-path package (opens new window) provides a simple way for Node.js users to load files from the filesystem into the File objects that the Web3.Storage client library likes to use.

Here's a quick example:

import { getFilesFromPath } from 'web3.storage'

async function storeFiles(path = 'path/to/somewhere') {
  const files = await getFilesFromPath(path)
  for (const f of files) {
    console.log(f)
    // { name: '/path/to/me', stream: [Function: stream] }
  }

  const web3Storage = getStorageClient()
  const cid = await web3storage.put(files)
  console.log(`stored ${files.length} files. cid: ${cid}`)
}

Note that if you're using the client library you don't need to install the files-from-path package seperately. Instead, just import the getFilesFromPath or filesFromPath functions from the web3.storage package.

# ipfs-car

The Web3.Storage API works with Content Archive (CAR) files, which package up content addressed data into a simple format for storage and transport. Internally, the client library uses the ipfs-car package (opens new window) to create CARs from regular files before sending data to the API.

If you prefer to work with CARs directly, see the how-to guide on working with Content Archives for usage information for ipfs-car and information about other options.