Skip to content
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

Closed
wants to merge 3 commits into from

Conversation

ghost
Copy link

@ghost ghost commented Feb 14, 2020

  • added function to pipe data located at the provided path into the provided writable stream

  • renamed pipeStream to uploadFromStream and downloadToStream

  • 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

@ghost ghost added the enhancement New feature or request label Feb 14, 2020
@ghost ghost requested review from kwisatz and floriansimon1 February 14, 2020 16:39
source/webdav.ts Outdated
export const getReadStream = clientFunction(rawGetReadStream);
export const touchFolder = clientFunction(rawTouchFolder);

export const pipeStream = clientFunction(rawUpload); // deprecated
Copy link
Member

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 ?

Copy link
Member

@kwisatz kwisatz Feb 14, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Author

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

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 () => {
Copy link
Member

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?


expect(await client.get(path)).toBe(string);

await client.remove(path);
});
});

fdescribe('download(sourcePath, writeStream)', () => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fdescribe ?

Copy link
Author

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>;
Copy link
Member

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

Copy link
Author

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

@floriansimon1
Copy link
Collaborator

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

@kwisatz
Copy link
Member

kwisatz commented Feb 14, 2020

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.

@ghost
Copy link
Author

ghost commented Feb 14, 2020

I could add a deadline when I'll remove the function alltogether

@floriansimon1
Copy link
Collaborator

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"

@ghost
Copy link
Author

ghost commented Feb 14, 2020

Yess, update incoming

@ghost ghost closed this Feb 14, 2020
@ghost ghost deleted the hotfix/pipe branch February 14, 2020 18:20
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants