curl --upload-file image.jpg http://localhost:9999/upload/hash
createdb vfs
psql -f docs/vfs.sql vfs
mkdir testdata
make run
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
HTTP Params:
- ns: namespace, default is ""
- ext: file extension, default is "jpg".
jpegor<empty>will convert tojpg.
- 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
- 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
- Run service in cli with
init-cfgargument to generateconfig.tomlwith 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"