steelbrain / steelbrain/node-ssh
Add SFTP atomic upload functionality
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 1k
- Forks
- 94
- PR merge metrics
- No merged PRs in 30d
Description
When uploading a file to a remote directory, the file is incomplete until finished. If pushed to a directory with a webserver, clients could download partial files and be very confused (I'm sure there are other situations where this could be an issue as well). rsync doesn't have this issue -- it uploads a temporary file, then rename it once the transfer is completed. However, rsync doesn't work everywhere.
I filed an issue at ssh2, but they were of the opinion that something higher up the stack should do this sort of thing, so here we are. In particular, it would be annoying to have to reimplement the directory upload code to insert this sort of functionality -- so it would be nice if either:
- There was a hook that made this possible for a user to implement
- Or there was an option that could be passed in that would activate the 'atomicPut' functionality
I've created a monkeypatch'ed version of this, works great on my server. It pushes as a dot + filename so that the webserver doesn't show it to clients, and then changes the filename once the upload is finished. I'd rather get rid of the monkeypatch, and I'm happy to do the changes + make a PR here if you'll accept it.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No repository file or test is named. Start by locating the SFTP file and directory-upload entry points, then compare the linked monkeypatched implementation. Done means users can opt into or hook atomic uploads so transfers use a temporary name and rename only after completion.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- node.js, typescript
- Domain
- networking
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100