3.2.1 • Published 14 days ago

@nextcloud/files v3.2.1

Weekly downloads
2,320
License
AGPL-3.0-or-later
Repository
github
Last release
14 days ago

@nextcloud/files

npm last version Code coverage Project documentation

Nextcloud Files helpers for Nextcloud apps and libraries

Usage example

Using WebDAV to query favorite nodes

import { davGetClient, davRootPath, getFavoriteNodes } from '@nextcloud/files'

const client = davGetClient()
// query favorites for the root folder (meaning all favorites)
const favorites = await getFavoriteNodes(client)
// which is the same as writing:
const favorites = await getFavoriteNodes(client, '/', davRootPath)

Using WebDAV to list all nodes in directory

import {
    davGetClient,
    davGetDefaultPropfind,
    davResultToNode,
    davRootPath,
    davRemoteURL
} from '@nextcloud/files'

// Get the DAV client for the default remote
const client = davGetClient()
// which is the same as writing
const client = davGetClient(davRemoteURL)
// of cause you can also configure another WebDAV remote
const client = davGetClient('https://example.com/dav')

const path = '/my-folder/' // the directory you want to list

// Query the directory content using the webdav library
// `davRootPath` is the files root, for Nextcloud this is '/files/USERID', by default the current user is used
const results = client.getDirectoryContents(`${davRootPath}${path}`, {
    details: true,
    // Query all required properties for a Node
    data: davGetDefaultPropfind()
})

// Convert the result to an array of Node
const nodes = results.data.map((result) => davResultToNode(r))
// If you specified a different root in the `getDirectoryContents` you must add this also on the `davResultToNode` call:
const nodes = results.data.map((result) => davResultToNode(r, myRoot))
// Same if you used a different remote URL:
const nodes = results.data.map((result) => davResultToNode(r, myRoot, myRemoteURL))
3.2.1

14 days ago

3.2.0

21 days ago

3.1.1

2 months ago

3.1.0

4 months ago

3.0.0-beta.20

8 months ago

3.0.0-beta.21

8 months ago

3.0.0-beta.22

8 months ago

3.0.0-beta.23

8 months ago

3.0.0-beta.24

7 months ago

3.0.0-beta.25

7 months ago

3.0.0-beta.26

7 months ago

3.0.0-beta.27

6 months ago

3.0.0-beta.19

9 months ago

3.0.0

6 months ago

3.0.0-beta.11

10 months ago

3.0.0-beta.12

9 months ago

3.0.0-beta.13

9 months ago

3.0.0-beta.14

9 months ago

3.0.0-beta.15

9 months ago

3.0.0-beta.16

9 months ago

3.0.0-beta.17

9 months ago

3.0.0-beta.18

9 months ago

3.0.0-beta.10

11 months ago

3.0.0-beta.9

1 year ago

3.0.0-beta.8

1 year ago

3.0.0-beta.7

1 year ago

3.0.0-beta.6

1 year ago

3.0.0-beta.5

2 years ago

3.0.0-beta.1

2 years ago

3.0.0-beta.3

2 years ago

3.0.0-beta.2

2 years ago

3.0.0-beta.4

2 years ago

3.0.1-beta.0

2 years ago

2.1.0

3 years ago

2.0.0

3 years ago

1.1.0

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago

0.1.0

5 years ago