[#7526] added $filesystem.s3 and $filesystem.local JSVM bindings

This commit is contained in:
Gani Georgiev
2026-02-14 11:48:34 +02:00
parent bc72525013
commit fcc680794c
5 changed files with 4688 additions and 4654 deletions

View File

@@ -2,6 +2,8 @@
- Made the optional `Bearer` token prefix case-insensitive ([#7525](https://github.com/pocketbase/pocketbase/pull/7525); thanks @benjamesfleming).
- Added `$filesystem.s3(...)` and `$filesystem.local(...)` JSVM bindings ([#7526](https://github.com/pocketbase/pocketbase/issues/7526)).
## v0.36.3

View File

@@ -739,6 +739,8 @@ func filesystemBinds(vm *goja.Runtime) {
obj := vm.NewObject()
vm.Set("$filesystem", obj)
obj.Set("s3", filesystem.NewS3)
obj.Set("local", filesystem.NewLocal)
obj.Set("fileFromPath", filesystem.NewFileFromPath)
obj.Set("fileFromBytes", filesystem.NewFileFromBytes)
obj.Set("fileFromMultipart", filesystem.NewFileFromMultipart)

View File

@@ -1015,7 +1015,33 @@ func TestFilesystemBinds(t *testing.T) {
baseBinds(vm)
filesystemBinds(vm)
testBindsCount(vm, "$filesystem", 4, t)
testBindsCount(vm, "$filesystem", 6, t)
// s3
{
v, err := vm.RunString(`$filesystem.s3("bucketName", "region", "endpoint", "accessKey", "secretKey", true)`)
if err != nil {
t.Fatal(err)
}
fsys, ok := v.Export().(*filesystem.System)
if !ok {
t.Fatalf("[s3] Expected System instance got %v", fsys)
}
}
// local
{
v, err := vm.RunString(`$filesystem.local("test")`)
if err != nil {
t.Fatal(err)
}
fsys, ok := v.Export().(*filesystem.System)
if !ok {
t.Fatalf("[s3] Expected System instance got %v", fsys)
}
}
// fileFromPath
{

View File

File diff suppressed because it is too large Load Diff

View File

@@ -894,6 +894,8 @@ declare namespace $security {
* @group PocketBase
*/
declare namespace $filesystem {
let s3: filesystem.newS3
let local: filesystem.newLocal
let fileFromPath: filesystem.newFileFromPath
let fileFromBytes: filesystem.newFileFromBytes
let fileFromMultipart: filesystem.newFileFromMultipart