Skip to content

Commit

Permalink
Merge branch 'main' into appwrite#1499-update-contributing-guide
Browse files Browse the repository at this point in the history
  • Loading branch information
gurjeetsinghvirdee authored Jan 30, 2025
2 parents c867e01 + 2c8d066 commit f940765
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ const storage = new Storage(client);
const file = await storage.createFile(
process.env.APPWRITE_BUCKET_ID,
ID.unique(),
InputFile.fromBlob(await response.blob(), "audio.mp3"),
InputFile.fromBuffer(await response.blob(), "audio.mp3"),
[Permission.read(Role.any())],
);
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ const storage = new Storage(client);
const file = await storage.createFile(
process.env.APPWRITE_BUCKET_ID,
ID.unique(),
InputFile.fromBlob(new Blob([response.audio]), "audio.mp3"),
InputFile.fromBuffer(new Blob([response.audio]), "audio.mp3"),
[Permission.read(Role.any())],
);
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class AppwriteService {
}

async createFile(bucketId, blob) {
const file = await InputFile.fromBlob(blob, 'audio.flac');
const file = await InputFile.fromBuffer(blob, 'audio.flac');
return await this.storage.createFile(bucketId, ID.unique(), file);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class AppwriteService {
}

async createFile(bucketId, blob) {
const file = await InputFile.fromBlob(blob, 'audio.flac');
const file = await InputFile.fromBuffer(blob, 'audio.flac');
return await this.storage.createFile(bucketId, ID.unique(), file);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ If you're using an Appwrite SDK, this is handled automatically.
If you're not using an SDK, you can [learn more about REST API file handling](/docs/apis/rest#files).

# InputFile {% #input-file %}
Every language and platform handles file inputs differently. This section documents the expected input type of each SDK. Where applicable, Appwrite provides an `InputFile` class to accept multiple file sources, like paths, buffers, streams, or plain text.
Every language and platform handles file inputs differently. This section documents the expected input type of each SDK. Where applicable, Appwrite provides an `InputFile` class to accept multiple file sources, like paths, buffers, or plain text.

# Client SDKs {% #client-sdks %}

Expand Down Expand Up @@ -188,8 +188,6 @@ The Appwrite NodeJS SDK expects an `InputFile` class for file inputs.
| ------------------------------------------ | ------------------------------------------------------------ |
| `InputFile.fromPath(filePath, filename)` | Used to upload files from a provided path. |
| `InputFile.fromBuffer(buffer, filename)` | Used to upload files from a [Buffer](https://nodejs.org/api/buffer.html#buffer) object. |
| `InputFile.fromBlob(blob, filename)` | Used to upload files from a [Blob](https://developer.mozilla.org/en-US/docs/Web/API/Blob) object. |
| `InputFile.fromStream(stream, filename, size)` | Used to upload files from a [Readable Stream](https://nodejs.org/api/stream.html#readable-streams) object. |
| `InputFile.fromPlainText(content, filename)` | Used to upload files in plain text. Expects a string encoded in UTF-8. |
{% /tabsitem %}
{% tabsitem #php title="PHP" %}
Expand Down Expand Up @@ -268,7 +266,6 @@ The Appwrite .NET SDK expects an `InputFile` class for file inputs.
| Method | Description |
| ------------------------------------------ | ------------------------------------------------------------ |
| `InputFile.FromPath(string path)` | Used to upload files from a provided path. |
| `InputFile.FromStream(Stream stream, string filename, string mimeType)` | Used to upload files from a [Stream](https://learn.microsoft.com/en-us/dotnet/api/system.io.stream?view=net-7.0) object. Specify the file [MIME type](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types) using the `mimeType` param. |
| `InputFile.FromBytes(byte[] bytes, string filename, string mimeType)` | Used to upload files from an array of bytes. Specify the file [MIME type](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types) using the `mimeType` param. |
{% /tabsitem %}
{% /tabs %}
Expand Down

0 comments on commit f940765

Please sign in to comment.