diff --git a/versioned_docs/version-latest/04-standard-library/cloud/bucket.md b/versioned_docs/version-latest/04-standard-library/cloud/bucket.md index 7015755e6..6f85596a6 100644 --- a/versioned_docs/version-latest/04-standard-library/cloud/bucket.md +++ b/versioned_docs/version-latest/04-standard-library/cloud/bucket.md @@ -174,7 +174,7 @@ new cloud.Bucket(props?: BucketProps); | rename | Move an object to a new location in the bucket. | | signedUrl | Returns a signed url to the given file. | | tryDelete | Delete an object from the bucket if it exists. | -| tryGet | Get an object from the bucket if it exists. | +| tryGet | Get an object from the bucket if it exists If the bytes returned are not a valid UTF-8 string, an error is thrown. | | tryGetJson | Gets an object from the bucket if it exists, parsing it as Json. | --- @@ -386,11 +386,13 @@ Key of the object. ##### `get` ```wing -inflight get(key: str): str +inflight get(key: str, options?: BucketGetOptions): str ``` Retrieve an object from the bucket. +If the bytes returned are not a valid UTF-8 string, an error is thrown. + ###### `key`Required - *Type:* str @@ -399,6 +401,14 @@ Key of the object. --- +###### `options`Optional + +- *Type:* BucketGetOptions + +Additional get options. + +--- + ##### `getJson` ```wing @@ -587,10 +597,10 @@ Key of the object. ##### `tryGet` ```wing -inflight tryGet(key: str): str +inflight tryGet(key: str, options?: BucketTryGetOptions): str ``` -Get an object from the bucket if it exists. +Get an object from the bucket if it exists If the bytes returned are not a valid UTF-8 string, an error is thrown. ###### `key`Required @@ -600,6 +610,14 @@ Key of the object. --- +###### `options`Optional + +- *Type:* BucketTryGetOptions + +Additional get options. + +--- + ##### `tryGetJson` ```wing @@ -754,6 +772,53 @@ Type of event. --- +### BucketGetOptions + +Options for `Bucket.get()`. + +#### Initializer + +```wing +bring cloud; + +let BucketGetOptions = cloud.BucketGetOptions{ ... }; +``` + +#### Properties + +| **Name** | **Type** | **Description** | +| --- | --- | --- | +| endByte | num | The ending byte to read up to (including). | +| startByte | num | The starting byte to read from. | + +--- + +##### `endByte`Optional + +```wing +endByte: num; +``` + +- *Type:* num +- *Default:* undefined + +The ending byte to read up to (including). + +--- + +##### `startByte`Optional + +```wing +startByte: num; +``` + +- *Type:* num +- *Default:* undefined + +The starting byte to read from. + +--- + ### BucketOnCreateOptions `onCreate` event options. @@ -921,6 +986,53 @@ The duration for the signed URL to expire. --- +### BucketTryGetOptions + +Options for `Bucket.tryGet()`. + +#### Initializer + +```wing +bring cloud; + +let BucketTryGetOptions = cloud.BucketTryGetOptions{ ... }; +``` + +#### Properties + +| **Name** | **Type** | **Description** | +| --- | --- | --- | +| endByte | num | The ending byte to read up to (including). | +| startByte | num | The starting byte to read from. | + +--- + +##### `endByte`Optional + +```wing +endByte: num; +``` + +- *Type:* num +- *Default:* undefined + +The ending byte to read up to (including). + +--- + +##### `startByte`Optional + +```wing +startByte: num; +``` + +- *Type:* num +- *Default:* undefined + +The starting byte to read from. + +--- + ### ObjectMetadata Metadata of a bucket object.