hobigo / nextcloud-node-client Goto Github PK
View Code? Open in Web Editor NEWNextcloud node.js client for TypeScript and JavaScript
Home Page: https://hobigo.github.io/nextcloud-node-client/
License: Apache License 2.0
Nextcloud node.js client for TypeScript and JavaScript
Home Page: https://hobigo.github.io/nextcloud-node-client/
License: Apache License 2.0
Describe the bug
getSubfolders returns original folder if folder name contains blanks
To Reproduce
folder with blank
get subfolders
Expected behavior
do not return original folder
Hey great package! I've been playing around with this and was wondering is there is anyway to get the preview link for image files?
Thanks.
Describe the bug
Methods such as client.getFolderContents
fail to generate properly URL encoded requests, resulting in HTTP 500 responses.
To Reproduce
Steps to reproduce the behavior:
client.getFolderContents
Expected behavior
The API is supposed to generate properly encoded URLs for HTTP requests to the nextcloud instance, resulting in appropiate and expected HTTP responses. For client.getFolderContents
, a list of folder contents of the specified folder should be returned.
Additional context
Pulled this lib directly from NPM, version according to package.json
is 1.8.1
.
Hey there...
I was just trying to async upload a larger video file following your example here:
https://github.com/hobigo/nextcloud-node-client/blob/master/docs/upload.md
But the console log only returns 0 or 100 when using the getPercentCompleted() command?
My Code:
let files = [{ sourceFileName: sourceFile, targetFileName: targetFile }];
let uc = new UploadFilesCommand(newClient, { files });
uc.execute();
while (uc.isFinished() !== true) {
await (async () => { return new Promise(resolve => setTimeout(resolve, 1000)) })();
console.log(uc.getPercentCompleted() + "%");
}
const uploadResult = uc.getResultMetaData();
if (uc.getStatus() === CommandStatus.success) {
console.log(uploadResult.messages);
console.log(uc.getBytesUploaded());
} else {
console.log(uploadResult.errors);
}
Here is my output:
0% 0% 0% 0% 0% 0% 0% 0% 0% 0% 0% 0% 0% 0% 100% [ '/video.mp4' ] 80275042
Or is this correct and it only returns IF the command UploadFilesCommand was completed? Sounds weird to me and is not really what I would expect. I would like to show the percentage of the file in progress.
Is your feature request related to a problem? Please describe.
We would like to find out if a share for a file or folder already has been created, before we create another one. As far as I can tell, this is not possible.
Describe the solution you'd like
Instead of using createShare to get the share.url, I think it would be better to have a command like getShareInfo or such and call this API as described here: https://docs.nextcloud.com/server/latest/developer_manual/client_apis/OCS/ocs-share-api.html#get-shares-from-a-specific-file-or-folder
Regards and thanks alot for this great package!!
Hi this is an awesome library, is there any plan to come back to it
Is your feature request related to a problem? Please describe.
I checked out the project and ran npm install
and npm run build
and got 204 typescript compiler errors. I can't find any information in this project which node version I should use and whether I need to do more steps to achieve a working compile.
Describe the solution you'd like
Please write a short how-to on how to set up this project for development.
Describe alternatives you've considered
You could make it "just work" ;)
Thanks for your time.
hello, i'm using your lib for the first time. I need to create share-link of a file but I cannot find API.
Is there a way to do that?
Thanks in advance.
Describe the bug
create share-link of a file
To Reproduce
Expected behavior
An API call to create share-link of the file
Additional context
Describe the bug
When calling getFolder function, it always return null
To Reproduce
Expected behavior
Receive a Folder object if the folder exist
Hi Holger,
just wanted to get in touch with you – and this is the only way we found – to discuss a possible collaboration and possibly the route to a merger of nextcloud-node-client and https://github.com/tentwentyfour/nextcloud-link
We might be able to get there faster if we collaborate, rather than building the same thing twice. If you're interested, let's discuss specifics. Get in touch with us a hello {at} tentwentyfour.lu (DE/EN)
Hey is your library compatible with node 10 or more ?
I always have this error when i try to install it !
[2/4] Fetching packages...
info [email protected]: The platform "win32" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
error [email protected]: The engine "node" is incompatible with this module. Expected version "8.x". Got "10.16.3"
error Found incompatible module.
Thank you
Improve performance to get the file folder ids:
replace getDirectoryContents with an own implementation to fetch the object id of files and folders directly.
seems nextcloud's webdav has a support for searching.
https://docs.nextcloud.com/server/16/developer_manual/client_apis/WebDAV/search.html
Is this implemented, or is there a way i can do manual webdav calls??
Describe the bug
uploadFolderCommand endless loop if folder does not exits
To Reproduce
use a non existing folder
Expected behavior
should return with an error result. Folder does not exist
Describe the bug
A clear and concise description of what the bug is.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
A clear and concise description of what you expected to happen.
Additional context
Add any other context about the problem here.
Describe the bug
const subfolder: Folder = await folder.createSubFolder('test');
const createShare: ICreateShare = {fileSystemElement: subfolder, publicUpload: true};
const share: Share = await client.createShare(createShare);
const shareLink: string = share.url;
Share URL should allow to upload files anonymously - it does not work.
Tested with Nextcloud 19.
Hello, is there a function to upload a file on disk to nextcloud?
Is your feature request related to a problem? Please describe.
Currently I don't find a way to copy files or folders from one nextcloud path to another. I can only find a only move
command.
Describe the solution you'd like
A copyFolder
and or copyFile
command would be great. Alternatively a "best practice copy showcase" based on the current library would be great!
Describe alternatives you've considered
I didn't find alternatives besides downloading and re-uploading (which I haven't tried yet).
https:///core/search?query=&inApps%5B%5D=files&page=1&size=30
https:///core/search?query=&inApps[]=files&page=1&size=30
response
id: 27813
link: "/apps/files/?dir=/...."
mime_type: "application/json"
modified: 1581859191
name: "20191231_102725.json"
path: "/......./20191231_102725.json"
permissions: 27
size: 220
type: "file"
Describe the bug
Getting this error:
https://xx.xx.xx.xx/ocs/v2.php/apps/serverinfo/api/v1/info?format=json failed, reason: unable to verify the first certificate
To Reproduce
Using the following code:
const api = require('nextcloud-node-client');
const server = new api.Server({
basicAuth:
{
username: "test",
password: "xxxx",
},
url: "https://xx.xx.xx.xx/remote.php/webdav",
});
const client = new api.Client(server);
const sys = await client.getSystemInfo();
this.log.info(sys.nextcloud.system.version);
I use as self signed certficat, perhaps this is the reason?
On other apps that communicate with nextcloud has option to accept self signed certificates.
Is there also such a option in the api?
url misses index.php part
node-fetch types are not exported in fakeServer and http client
export node-fetch types and verify with a demo project
tsc will fail
workaround:
add "@types/node-fetch" in dev dependencies
Describe the bug
When trying to initialize the client like this:
import Client from "nextcloud-node-client";
const client = new Client();
I get:
file:///C:/Users/ilja/Desktop/Projects/Development/Other/Plugins/steam-cloud-sync/nct.js:3
const client = new Client();
^
TypeError: Client is not a constructor
at file:///C:/Users/ilja/Desktop/Projects/Development/Other/Plugins/steam-cloud-sync/nct.js:3:16
at ModuleJob.run (node:internal/modules/esm/module_job:183:25)
at async Loader.import (node:internal/modules/esm/loader:178:24)
at async Object.loadESM (node:internal/process/esm_loader:68:5)
at async handleMainPromise (node:internal/modules/run_main:63:12)
To Reproduce
Expected behavior
Client should get initialized without any trouble
Additional context
Tried it with various TS configs and JS EMS syntax
I cannot make the library to work in javascript node application.
All examples are in typescript.
Could you please provide a couple of examples on how to create a client in vanilla javascript?
I am trying to do unit testing using Jest to test functions of creating folder and deleting folder from the next cloud.
I can create the file/folder successfully but when I end the test to delete it immediately I got an error says
{
code: 'ERR_UNEXPECTED_HTTP_STATUS',
context: {
expectedHttpStatusCodes: [ 204 ],
responseStatus: 423,
responseStatusText: 'Locked'
}
}
I think the reason is that the file is locked and needs some time to be able to delete it, I tried many solutions but did not worked out.
Is there any option can I include in the body request to override this rule?.
Hi, I read the source code of the library, and could not find how to create a share with particular users. but I am allowed to create share.
how can I specify with which user this folder will be shared?.
Describe the bug
client.getQuota() returns two numbers that are not the real available or used quota of the user. These two numbers are from two separated entries of the PROPFIND command issued inside the getQuota() call.
To Reproduce
Steps to reproduce the behavior:
const ncc = require( 'nextcloud-node-client');
const server_data = { basicAuth: { username: auth.username, password: auth.password }, url: server_url, };
const server = new ncc.Server( server_data );
const client = new ncc.Client( server);
const user_quota = await client.getQuota();
Correction
after looking into the code:
public async getQuota(): Promise<IQuota> {
log.debug("getQuota");
const requestInit: RequestInit = {
method: "PROPFIND",
};
const response: Response = await this.getHttpResponse(this.webDAVUrl + "/", requestInit, [207], { description: "Client get quota" });
...
In requestInit
it seems that headers: new node_fetch_1.Headers({ "Depth": "0" }),
is missing.
With
const requestInit: RequestInit = {
method: "PROPFIND",
headers: new node_fetch_1.Headers({ "Depth": "0" }),
};
it returns the expected result.
client_patch.txt
Is your feature request related to a problem? Please describe.
Shares for UserGroups are not implemented yet. I would like to work with them making use of this fine library.
Describe the solution you'd like
Implementation of sharing for user groups.
Hi. Is there a chance to add a search function for files after specific idTag or nameTag?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.