Skip to content

vmkteam/vfs

Repository files navigation

VFS Service

Release Build Status

Examples

Hash upload

curl --upload-file image.jpg http://localhost:9999/upload/hash

How to run

createdb vfs
psql -f docs/vfs.sql vfs
mkdir testdata
make run

Upload image

wget -O image.jpg https://media.myshows.me/shows/e/22/e22c3ab75b956c6c1c1fca8182db7efb.jpg
export AUTHTOKEN=`curl http://localhost:9999/auth-token`    
curl --upload-file image.jpg  -H  "AuthorizationJWT: ${AUTHTOKEN}" http://localhost:9999/upload/hash
open http://localhost:9999/media/6/4a/64a9f060983200709061894cc5f69f83.jpg

Upload modes

HTTP Params:

  • ns: namespace, default is ""
  • ext: file extension, default is "jpg". jpeg or <empty> will convert to jpg.

Hash Upload via HTTP PUT

  • Default namespace and default extension (jpg): curl --upload-file image.jpg http://localhost:9999/upload/hash
  • Specific namespace (test): curl --upload-file image.jpg http://localhost:9999/upload/hash?ns=test
  • Specific namespace (test) with file extension: curl --upload-file image.gif http://localhost:9999/upload/hash?ns=test&ext=gif

Hash Upload via HTTP POST

  • Default namespace and default extension (jpg): curl -F '[email protected]' http://localhost:9999/upload/hash
  • Specific namespace (test): curl -F '[email protected]' http://localhost:9999/upload/hash?ns=test
  • Specific namespace (test) with file extension: curl -F '[email protected]' http://localhost:9999/upload/hash?ns=test&ext=gif

Default configuration

  • Run service in cli with init-cfg argument to generate config.toml with default configuration.
  • Default configuration example:
[Server]
  Host = "0.0.0.0"
  Port = 9999
  IsDevel = false
  JWTHeader = "AuthorizationJWT"
  JWTKey = "<some_generated_jwt_key>"
  Index = false
  IndexBlurhash = true
  IndexWorkers = 6
  IndexBatchSize = 64

[VFS]
  MaxFileSize = 33554432
  Path = "testdata"
  WebPath = "/media/"
  PreviewPath = "/media/small/"
  Namespaces = ["items", "test"]
  Extensions = ["jpg", "jpeg", "png", "gif"]
  MimeTypes = ["image/jpeg", "image/png", "image/gif"]
  UploadFormName = "Filedata"
  SaltedFilenames = false
  SkipFolderVerify = false

[Database]
  Addr     = "localhost:5432"
  User     = "postgres"
  Password = ""
  Database = "apisrv"
  PoolSize = 10
  ApplicationName = "vfssrv"

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors 4

  •  
  •  
  •  
  •