-
-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement second pipe function to 'download' from nextcloud #10
Conversation
source/webdav.ts
Outdated
export const getReadStream = clientFunction(rawGetReadStream); | ||
export const touchFolder = clientFunction(rawTouchFolder); | ||
|
||
export const pipeStream = clientFunction(rawUpload); // deprecated |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should probably emit a warning?! How would one do that in a library ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thought the same. Will do process.emitWarning
tests/webdav-jest.ts
Outdated
describe('pipeStream(path, stream)', () => { | ||
it('should pipe readable streams to the Nextcloud instance', async () => { | ||
describe('upload(targetPath, readStream)', () => { | ||
it('should pipe data to the Nextcloud instance', async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, it's not wrong that upload
and download
both still expect streams, is it?
tests/webdav-jest.ts
Outdated
|
||
expect(await client.get(path)).toBe(string); | ||
|
||
await client.remove(path); | ||
}); | ||
}); | ||
|
||
fdescribe('download(sourcePath, writeStream)', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fdescribe
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks, forgot to remove the focus
source/types.ts
Outdated
@@ -30,7 +30,9 @@ export interface NextcloudClientInterface extends NextcloudClientProperties { | |||
getFolderProperties(path: string, extraProperties?: FileDetailProperty[]): Promise<FolderProperties>; | |||
configureWebdavConnection(options: ConnectionOptions): void; | |||
configureOcsConnection(options: ConnectionOptions): void; | |||
pipeStream(path: string, stream: Stream.Readable): Promise<void>; | |||
pipeStream(path: string, readStream: Stream.Readable): Promise<void>; | |||
upload(targetPath: string, readStream: Stream.Readable): Promise<void>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about uploadFromStream
and downloadToStream
?
Or, to stay with webdav
terms:
postFromStream
and getAsStream
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
uploadFromStream and downloadToStream sound ok
Do you think just removing the function would be better? Sure, that requires amajor version bump but it might be worth it given the small adoption the library has |
I simply didn't think that this should make it a nextcloud-link v2.0.0… from a semver POV, yes, it could also be done like that, but feels odd. |
I could add a deadline when I'll remove the function alltogether |
Yeah, you could say something along the line of "this will be removed in version 2" |
Yess, update incoming |
added function to pipe data located at the provided path into the provided writable stream
renamed
pipeStream
touploadFromStream
anddownloadToStream
I have carefully evaluated the risks of this change
This change does not remove existing functionality
I have written tests to cover all risks
I updated the docs