Comments (6)
Is there any call back function I can use to perform this operation.
If you use tusd programmatically using it's Go API, you can listen on the CompleteUploads
channel in your handler struct (https://godoc.org/github.com/tus/tusd#UnroutedHandler). In the case that you are simply running the tusd binary, we currently have a hook system which allows you to run scripts whenever an upload is finished. However, this feature is not well documented yet, but you can try it:
tusd -hooks-dir ./hooks/
This will cause the ./hooks/post-finish
file to be executed if an upload finishes. The process will have special environment variables (and can read from stdin) for more information about the upload (see https://github.com/tus/tusd/blob/master/cmd/tusd/main.go#L182).
I have 'n' number of clients uploading files; I want to store the files in separate directory with respect to the client uploading it.
I guess, the best way to implement this is to move the files after they have been uploaded and not in the beginning. You can use the hooks system for this as described above.
from tusd.
Thanks for the quick and detailed reply. hooks system will solve my problem and have gone through the hooks function.
I have developed the upload client using tus java client library; now the requirement is I should move the customer uploaded files under their directory; not to store all files in same directory. Is there any way I can share the customer guid to the server/ store it in the info.json; then I can use post finish hook to move the file to respective directory.
from tusd.
You can use the TusUpload#setMetadata
method to add optional information to an upload:
TusUpload upload = new TusUpload(/* ... */);
Map<String, String> meta = upload.getMetadata();
meta.put("client_id", "55");
upload.setMetadata(meta);
This will then show up in the .info
file in the MetaData
object.
from tusd.
Thanks for the update. Hope this solves my problem. Will check and update
from tusd.
The following code
Map<String, String> meta = upload.getMetadata();
always returns null and adding new <k,v> pair throws null pointer exception.
I followed the same code which you have mentioned, since it returned null; I used
Map<String, String> meta = new HashMap<String, String>();
and it worked.
from tusd.
That's correct. It's not guaranteed that the object returned is not null. I will make sure to update the documentation to fix this.
from tusd.
Related Issues (20)
- Exposing header via cors-expose-header Issue HOT 2
- GPS metadata are removed when uploading images
- Breacking change on Hook-Name header HOT 2
- Second attempt to host a Helm chart HOT 5
- Allow stopping uploads in PatchRequest before any data is passed to the store HOT 3
- handler: support HTTP range requests in GET /:upload HOT 3
- Support RUFH draft-01 and -02
- S3 backend with TUS handler fails to handle PATCH HOT 10
- Keep old metadata after modifying it in pre-create hook HOT 1
- S3 Storage GetReader Range Support HOT 1
- Uniform Termination Process for Store Implementations: Ensuring Consistent Removal of Binary and .info Files HOT 1
- Cleaning up .info files HOT 3
- s3store: Experiment with optimistic part uploads to S3 HOT 2
- Tus returning http in initial response causing redirect to https to strip authorization headers HOT 3
- docs: Add developing and contributing guide
- docs: Add example usage with Minio and Azurite
- Many post-receive hooks after post-finish hook HOT 3
- Unable to fetch Upload Id from Path HOT 1
- cli: Option log-format=json is ignored for plugin logs HOT 1
- using tusd handler with gorilla mux causing "NetworkControlError" warnings HOT 10
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tusd.