code
DveloxSoft Bucket Developer integration guides

Access Files

Interact with files and directories inside a container. All endpoints accept a container slug and a path relative to the container root. Public containers allow unauthenticated reads.

List a directory

Call GET /files/:containerSlug/*path. If the path is a directory, the server returns a JSON listing. If it is a file, it returns the file stream.

typescript
const response = await fetch(
  `https://bucket.dveloxsoft.com/api/files/${containerSlug}/${encodeURIComponent(path)}`,
  {
    headers: {
      'Authorization': 'ApiKey <api_key>'
    }
  }
);

if (!response.ok) {
  const error = await response.json();
  throw new Error(error.message || 'Failed to list directory');
}

const listing = await response.json();
console.log('Current path:', listing.path);
for (const item of listing.items) {
  console.log(item.type, item.name, item.path);
}

Download or stream a file

Request the file path with GET /files/:containerSlug/*path. The response is a binary stream. In a browser you can open it directly or convert it to a blob URL.

typescript
// Open in browser tab
window.open(
  `https://bucket.dveloxsoft.com/api/files/${containerSlug}/${encodeURIComponent(filePath)}`,
  '_blank'
);

// Or stream as blob in JavaScript
const response = await fetch(
  `https://bucket.dveloxsoft.com/api/files/${containerSlug}/${encodeURIComponent(filePath)}`,
  {
    headers: { 'Authorization': 'Bearer <jwt_token>' }
  }
);

const blob = await response.blob();
const url = URL.createObjectURL(blob);
const link = document.createElement('a');
link.href = url;
link.download = 'filename.ext';
link.click();
URL.revokeObjectURL(url);

Create a directory

Send POST /files/:containerSlug/*path/directory with the desired directory path in the URL.

typescript
const response = await fetch(
  `https://bucket.dveloxsoft.com/api/files/${containerSlug}/${encodeURIComponent('new/folder/path')}/directory`,
  {
    method: 'POST',
    headers: {
      'Authorization': 'ApiKey <api_key>'
    }
  }
);

if (!response.ok) {
  const error = await response.json();
  throw new Error(error.message || 'Failed to create directory');
}

console.log('Directory created');

Move or rename

Send POST /files/:containerSlug/*path/move with the destination path in the body.

typescript
const response = await fetch(
  `https://bucket.dveloxsoft.com/api/files/${containerSlug}/${encodeURIComponent('old/path.txt')}/move`,
  {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'Authorization': 'ApiKey <api_key>'
    },
    body: JSON.stringify({
      newPath: 'new/path.txt'
    })
  }
);

if (!response.ok) {
  const error = await response.json();
  throw new Error(error.message || 'Failed to move item');
}

console.log('Item moved');

Delete

Send DELETE /files/:containerSlug/*path. This permanently removes the file or directory.

typescript
const response = await fetch(
  `https://bucket.dveloxsoft.com/api/files/${containerSlug}/${encodeURIComponent('path/to/file.txt')}`,
  {
    method: 'DELETE',
    headers: {
      'Authorization': 'ApiKey <api_key>'
    }
  }
);

if (!response.ok) {
  const error = await response.json();
  throw new Error(error.message || 'Failed to delete item');
}

console.log('Item deleted');