Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
@flakey5/r2-localize
Advanced tools
Allows for serving files from different R2 buckets based on the request's region.
Allows for serving files from different R2 buckets based on the request's region.
Primary use cases would be lowering latency or serving localized files.
const localizedBucket = localizeBucket({
buckets: {
wnam: env.WNAM_BUCKET,
enam: env.ENAM_BUCKET,
weur: env.WEUR_BUCKET,
eeur: env.EEUR_BUCKET,
apac: env.APAC_BUCKET,
},
// Region to use if one of the regions is undefined or we couldn't identify what region a colo is in/closest to
fallbackRegion: 'wnam',
});
// Heading a file
const object: R2Object | null = await localizedBucket.head('some-object', {
request,
});
const object: R2Object | R2ObjectBody | null = await localizedBucket.get(
'some-object',
{
request,
// R2GetOptions properties here, e.g.
onlyIf: {
// ...
},
}
);
Note: this puts the object in the nearest bucket only. The other buckets are unaffected.
const object: R2Object | null = await localizedBucket.put(
'some-object',
'some-value',
{
request,
// R2PutOptions properties here, e.g.
onlyIf: {
// ...
},
}
);
Note: this puts the object in the nearest bucket only. The other buckets are unaffected.
const object: R2MultipartUpload = await localizedBucket.createMultipartUpload(
'some-object',
{
request,
// R2MultipartOptions properties here, e.g.
httpMetadata: {
// ...
},
}
);
Note: this puts the object in the nearest bucket only. The other buckets are unaffected.
const object: R2MultipartUpload = await localizedBucket.resumeMultipartUpload(
'some-object',
'upload id',
{ request }
);
Note: this deletes the object in the nearest bucket only. The other buckets are unaffected.
await localizedBucket.resumeMultipartUpload('some-object', 'upload id', {
request,
});
const object: R2Objects = await localizedBucket.list({
request,
// R2ListOptions properties here, e.g.
prefix: 'asd',
});
To access the bucket of a specific region, you can pass in the region's name instead of the request object.
const object: R2Object | R2ObjectBody | null = await localizedBucket.get(
'some-object',
{
region: 'wnam',
// R2GetOptions properties here, e.g.
onlyIf: {
// ...
},
}
);
This repository is licensed under the terms of the MIT License.
FAQs
Allows for serving files from different R2 buckets based on the request's region.
The npm package @flakey5/r2-localize receives a total of 4 weekly downloads. As such, @flakey5/r2-localize popularity was classified as not popular.
We found that @flakey5/r2-localize demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.