@nextcloud/files 3.4.0 → 3.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,5 +1,9 @@
1
+ <!--
2
+ - SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors
3
+ - SPDX-License-Identifier: AGPL-3.0-or-later
4
+ -->
1
5
  # @nextcloud/files
2
- [![npm last version](https://img.shields.io/npm/v/@nextcloud/files.svg?style=flat-square)](https://www.npmjs.com/package/@nextcloud/files) [![Code coverage](https://img.shields.io/codecov/c/github/nextcloud-libraries/nextcloud-files?style=flat-square)](https://app.codecov.io/gh/nextcloud-libraries/nextcloud-files) [![Project documentation](https://img.shields.io/badge/documentation-online-blue?style=flat-square)](https://nextcloud-libraries.github.io/nextcloud-files/)
6
+ [![npm last version](https://img.shields.io/npm/v/@nextcloud/files.svg?style=flat-square)](https://www.npmjs.com/package/@nextcloud/files) [![REUSE status](https://api.reuse.software/badge/github.com/nextcloud-libraries/nextcloud-files)](https://api.reuse.software/info/github.com/nextcloud-libraries/nextcloud-files) [![Code coverage](https://img.shields.io/codecov/c/github/nextcloud-libraries/nextcloud-files?style=flat-square)](https://app.codecov.io/gh/nextcloud-libraries/nextcloud-files) [![Project documentation](https://img.shields.io/badge/documentation-online-blue?style=flat-square)](https://nextcloud-libraries.github.io/nextcloud-files/)
3
7
 
4
8
  Nextcloud Files helpers for Nextcloud apps and libraries
5
9
 
@@ -1,6 +1,12 @@
1
1
  import { FileType } from './fileType';
2
- import { Node } from './node';
2
+ import { INode, Node } from './node';
3
3
 
4
4
  export declare class File extends Node {
5
5
  get type(): FileType;
6
6
  }
7
+ /**
8
+ * Interface of the File class
9
+ */
10
+ export interface IFile extends INode {
11
+ readonly type: FileType.File;
12
+ }
@@ -1,23 +1,6 @@
1
1
  /**
2
- * @copyright Copyright (c) 2022 John Molakvoæ <skjnldsv@protonmail.com>
3
- *
4
- * @author John Molakvoæ <skjnldsv@protonmail.com>
5
- *
6
- * @license AGPL-3.0-or-later
7
- *
8
- * This program is free software: you can redistribute it and/or modify
9
- * it under the terms of the GNU Affero General Public License as
10
- * published by the Free Software Foundation, either version 3 of the
11
- * License, or (at your option) any later version.
12
- *
13
- * This program is distributed in the hope that it will be useful,
14
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
- * GNU Affero General Public License for more details.
17
- *
18
- * You should have received a copy of the GNU Affero General Public License
19
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
20
- *
2
+ * SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors
3
+ * SPDX-License-Identifier: AGPL-3.0-or-later
21
4
  */
22
5
  export declare enum FileType {
23
6
  Folder = "folder",
@@ -1,5 +1,5 @@
1
1
  import { FileType } from './fileType';
2
- import { Node } from './node';
2
+ import { INode, Node } from './node';
3
3
  import { NodeData } from './nodeData';
4
4
 
5
5
  export declare class Folder extends Node {
@@ -8,3 +8,11 @@ export declare class Folder extends Node {
8
8
  get extension(): string | null;
9
9
  get mime(): string;
10
10
  }
11
+ /**
12
+ * Interface of the folder class
13
+ */
14
+ export interface IFolder extends INode {
15
+ readonly type: FileType.Folder;
16
+ readonly extension: null;
17
+ readonly mime: 'httpd/unix-directory';
18
+ }
@@ -60,10 +60,12 @@ export declare abstract class Node {
60
60
  get mime(): string | undefined;
61
61
  /**
62
62
  * Get the file modification time
63
- * There is no setter as the modification time is not meant to be changed manually.
64
- * It will be automatically updated when the attributes are changed.
65
63
  */
66
64
  get mtime(): Date | undefined;
65
+ /**
66
+ * Set the file modification time
67
+ */
68
+ set mtime(mtime: Date | undefined);
67
69
  /**
68
70
  * Get the file creation time
69
71
  * There is no setter as the creation time is not meant to be changed
@@ -136,13 +138,18 @@ export declare abstract class Node {
136
138
  */
137
139
  rename(basename: string): void;
138
140
  /**
139
- * Update the mtime if exists.
141
+ * Update the mtime if exists
140
142
  */
141
- private updateMtime;
143
+ updateMtime(): void;
142
144
  /**
143
145
  * Update the attributes of the node
146
+ * Warning, updating attributes will NOT automatically update the mtime.
144
147
  *
145
148
  * @param attributes The new attributes to update on the Node attributes
146
149
  */
147
150
  update(attributes: Attribute): void;
148
151
  }
152
+ /**
153
+ * Interface of the node class
154
+ */
155
+ export type INode = Pick<Node, keyof Node>;