iterdir

迭代目录

这个模块提供了一些和目录信息罗列有关的函数

p115client.tool.iterdir.ensure_attr_path(client: str | PathLike | P115Client | P115OpenClient, attrs: Iterable[D], with_ancestors: bool = False, with_path: bool = True, escape: None | bool | Callable[[str], str] = True, id_to_dirnode: None | EllipsisType | MutableMapping[int, tuple[str, int]] = None, app: str = 'web', *, async_: Literal[False] = False, **request_kwargs) Iterator[D][source]
p115client.tool.iterdir.ensure_attr_path(client: str | PathLike | P115Client | P115OpenClient, attrs: Iterable[D] | AsyncIterable[D], with_ancestors: bool = False, with_path: bool = True, escape: None | bool | Callable[[str], str] = True, id_to_dirnode: None | EllipsisType | MutableMapping[int, tuple[str, int]] = None, app: str = 'web', *, async_: Literal[True], **request_kwargs) AsyncIterator[D]

为一组文件信息添加 “path” 字段,可选 “path” 或 “ancestors” 字段

Caution

风控非常严重,请谨慎使用

Parameters:
  • client – 115 客户端或 cookies

  • attrs – 一组文件或目录的信息

  • with_ancestors – 文件信息中是否要包含 “ancestors”

  • with_path – 文件信息中是否要包含 “path”

  • escape

    对文件名进行转义

    • 如果为 None,则不处理;否则,这个函数用来对文件名中某些符号进行转义,例如 “/” 等

    • 如果为 True,则使用 posixpatht.escape,会对文件名中 “/”,或单独出现的 “.” 和 “..” 用 “" 进行转义

    • 如果为 False,则使用 posix_escape_name 函数对名字进行转义,会把文件名中的 “/” 转换为 “|”

    • 如果为 Callable,则用你所提供的调用,以或者转义后的名字

  • id_to_dirnode – 字典,保存 id 到对应文件的 (name, parent_id) 元组的字典,如果为 …,则忽略

  • app – 使用指定 app(设备)的接口

  • async – 是否异步

  • request_kwargs – 其它请求参数

Returns:

迭代器

p115client.tool.iterdir.ensure_attr_path_using_star_event(client: str | PathLike | P115Client, attrs: Iterable[D], with_ancestors: bool = False, life_event_cooldown: int | float = 0.5, escape: None | bool | Callable[[str], str] = True, id_to_dirnode: None | EllipsisType | MutableMapping[int, tuple[str, int]] = None, app: str = 'android', *, async_: Literal[False] = False, **request_kwargs) Iterator[D][source]
p115client.tool.iterdir.ensure_attr_path_using_star_event(client: str | PathLike | P115Client, attrs: Iterable[D] | AsyncIterable[D], with_ancestors: bool = False, life_event_cooldown: int | float = 0.5, escape: None | bool | Callable[[str], str] = True, id_to_dirnode: None | EllipsisType | MutableMapping[int, tuple[str, int]] = None, app: str = 'android', *, async_: Literal[True], **request_kwargs) AsyncIterator[D]

为一组文件信息添加 “path” 字段,另外可选 “ancestors” 字段

Parameters:
  • client – 115 客户端或 cookies

  • attrs – 一组文件或目录的信息

  • with_ancestors – 文件信息中是否要包含 “ancestors”

  • life_event_cooldown – 冷却时间,大于 0 时,两次拉取操作事件的接口调用之间至少间隔这么多秒

  • escape

    对文件名进行转义

    • 如果为 None,则不处理;否则,这个函数用来对文件名中某些符号进行转义,例如 “/” 等

    • 如果为 True,则使用 posixpatht.escape,会对文件名中 “/”,或单独出现的 “.” 和 “..” 用 “" 进行转义

    • 如果为 False,则使用 posix_escape_name 函数对名字进行转义,会把文件名中的 “/” 转换为 “|”

    • 如果为 Callable,则用你所提供的调用,以或者转义后的名字

  • id_to_dirnode – 字典,保存 id 到对应文件的 (name, parent_id) 元组的字典

  • app – 使用指定 app(设备)的接口

  • async – 是否异步

  • request_kwargs – 其它请求参数

Returns:

返回这一组文件信息

p115client.tool.iterdir.extract_iter_files(client: str | PathLike | P115Client, pickcode: str | int | Mapping, path: str | Mapping = '/', app: str = 'web', *, async_: Literal[False] = False, **request_kwargs) Iterator[dict][source]
p115client.tool.iterdir.extract_iter_files(client: str | PathLike | P115Client, pickcode: str | int | Mapping, path: str | Mapping = '/', app: str = 'web', *, async_: Literal[True], **request_kwargs) AsyncIterator[dict]

批量获取压缩包中的文件列表

Parameters:
  • client – 115 客户端或 cookies

  • pickcode – 压缩文件的 pickcode 或 id

  • path – 压缩包内(目录)路径,为空则是压缩包的根目录

  • app – 使用指定 app(设备)的接口

  • async – 是否异步

  • request_kwargs – 其它请求参数

Returns:

迭代器,返回此分享链接下的(所有文件)文件信息,由于接口返回信息有限,所以比较简略

{
    "id": int,
    "sha1": str,
    "name": str,
    "size": int,
    "path": str,
}

p115client.tool.iterdir.extract_iterdir(client: str | PathLike | P115Client, pickcode: str | int | Mapping, path: str | Mapping = '/', page_size: int = 999, app: str = 'web', cooldown: None | float = None, *, async_: Literal[False] = False, **request_kwargs) Iterator[dict][source]
p115client.tool.iterdir.extract_iterdir(client: str | PathLike | P115Client, pickcode: str | int | Mapping, path: str | Mapping = '/', page_size: int = 999, app: str = 'web', cooldown: None | float = None, *, async_: Literal[True], **request_kwargs) AsyncIterator[dict]

对压缩包迭代目录,获取文件信息

Parameters:
  • client – 115 客户端或 cookies

  • pickcode – 压缩文件的 pickcode 或 id

  • path – 压缩包内(目录)路径,为空则是压缩包的根目录

  • page_size – 分页大小,最大 999

  • app – 使用指定 app(设备)的接口

  • cooldown – 冷却时间,单位为秒。如果为 None,则用默认值(非并发时为 0,并发时为 1)

  • async – 是否异步

  • request_kwargs – 其它请求参数

Returns:

迭代器,返回此目录内的文件信息(文件和目录)

p115client.tool.iterdir.extract_iterdir_traverse(client: str | PathLike | P115Client, pickcode: str | int | Mapping, path: str | Mapping = '/', page_size: int = 999, topdown: None | bool = True, min_depth: int = 1, max_depth: int = -1, predicate: None | bool | Callable[[dict], Any] = None, onerror: bool | Callable[[OSError], Any] = False, app: str = 'web', cooldown: None | float = None, *, async_: Literal[False] = False, **request_kwargs) Iterator[dict][source]
p115client.tool.iterdir.extract_iterdir_traverse(client: str | PathLike | P115Client, pickcode: str | int | Mapping, path: str | Mapping = '/', page_size: int = 999, topdown: None | bool = True, min_depth: int = 1, max_depth: int = -1, predicate: None | bool | Callable[[dict], Any] = None, onerror: bool | Callable[[OSError], Any] = False, app: str = 'web', cooldown: None | float = None, *, async_: Literal[True], **request_kwargs) AsyncIterator[dict]

迭代目录树,获取文件信息

Attention

这个函数不支持并发,而且是对罗列目录接口的循环调用,所以速度会比较慢,而且也容易被风控(可以设置 cooldown 以限制接口调用频率)

Parameters:
  • client – 115 客户端或 cookies

  • pickcode – 压缩文件的 pickcode 或 id

  • path – 压缩包内(目录)路径,为空则是压缩包的根目录

  • page_size – 分页大小,最大 999

  • topdown – 如果是 True,自顶向下深度优先搜索;如果是 False,自底向上深度优先搜索;如果是 None,广度优先搜索

  • min_depth – 最小深度,top 本身为 0

  • max_depth – 最大深度,< 0 时不限

  • predicate

    调用以筛选遍历得到的路径

    • 如果为 None,则不做筛选

    • 如果为 True,则只输出文件

    • 如果为 False,则只输出目录

    • 否则,就是 Callable。对于返回值
      • 如果为 True,则输出它,且会继续搜索它的子树

      • 如果为 False,则跳过它,但会继续搜索它的子树

      • 如果为 1,则输出它,但跳过它的子树

      • 如果为 0,则跳过它,且跳过它的子树

  • onerror – 处理 OSError 异常。如果是 True,抛出异常;如果是 False,忽略异常;如果是调用,以异常为参数调用之

  • app – 使用指定 app(设备)的接口

  • cooldown – 冷却时间,单位为秒。如果为 None,则用默认值(非并发时为 0,并发时为 1)

  • async – 是否异步

  • request_kwargs – 其它请求参数

Returns:

迭代器,返回此目录内的文件信息(文件和目录)

p115client.tool.iterdir.extract_iterdir_walk(client: str | PathLike | P115Client, pickcode: str | int | Mapping, path: str | Mapping = '/', page_size: int = 999, topdown: None | bool = True, min_depth: int = 1, max_depth: int = -1, onerror: bool | Callable[[OSError], Any] = False, app: str = 'web', cooldown: None | float = None, *, async_: Literal[False] = False, **request_kwargs) Iterator[tuple[int, list[dict], list[dict]]][source]
p115client.tool.iterdir.extract_iterdir_walk(client: str | PathLike | P115Client, pickcode: str | int | Mapping, path: str | Mapping = '/', page_size: int = 999, topdown: None | bool = True, min_depth: int = 1, max_depth: int = -1, onerror: bool | Callable[[OSError], Any] = False, app: str = 'web', cooldown: None | float = None, *, async_: Literal[True], **request_kwargs) AsyncIterator[tuple[int, list[dict], list[dict]]]

迭代目录树,获取文件信息

Attention

这个函数不支持并发,而且是对罗列目录接口的循环调用,所以速度会比较慢,而且也容易被风控(可以设置 cooldown 以限制接口调用频率)

Parameters:
  • client – 115 客户端或 cookies

  • pickcode – 压缩文件的 pickcode 或 id

  • path – 压缩包内(目录)路径,为空则是压缩包的根目录

  • page_size – 分页大小,最大 999

  • topdown – 如果是 True,自顶向下深度优先搜索;如果是 False,自底向上深度优先搜索;如果是 None,广度优先搜索

  • min_depth – 最小深度,top 本身为 0

  • max_depth – 最大深度,< 0 时不限

  • onerror – 处理 OSError 异常。如果是 True,抛出异常;如果是 False,忽略异常;如果是调用,以异常为参数调用之

  • app – 使用指定 app(设备)的接口

  • cooldown – 冷却时间,单位为秒。如果为 None,则用默认值(非并发时为 0,并发时为 1)

  • async – 是否异步

  • request_kwargs – 其它请求参数

Returns:

迭代器,产生 (pid, 目录信息列表, 文件信息列表) 元组

p115client.tool.iterdir.iter_dir_nodes_using_star(client: str | PathLike | P115Client, ids: Iterable[int | str], id_to_dirnode: None | EllipsisType | MutableMapping[int, tuple[str, int]] = None, raise_for_changed_count: bool = False, app: str = 'android', cooldown: None | float = None, max_workers: None | int = 0, already_stared: bool = False, *, async_: Literal[False] = False, **request_kwargs) Iterator[dict][source]
p115client.tool.iterdir.iter_dir_nodes_using_star(client: str | PathLike | P115Client, ids: Iterable[int | str], id_to_dirnode: None | EllipsisType | MutableMapping[int, tuple[str, int]] = None, raise_for_changed_count: bool = False, app: str = 'android', cooldown: None | float = None, max_workers: None | int = 0, already_stared: bool = False, *, async_: Literal[True], **request_kwargs) AsyncIterator[dict]

通过先打星标来,然后用文件列表接口获取一组 id 的信息(仅支持目录)

Caution

在打星标后,随即还会把备注清空(以改变目录的更新时间),若要保留备注,则请不要使用此方法

Caution

如果有任一 id 已经被删除,则打星标时会报错

Parameters:
  • client – 115 客户端或 cookies

  • ids – 一组目录的 id 或 pickcode(如果包括文件,则会被忽略)

  • id_to_dirnode – 字典,保存 id 到对应文件的 (name, parent_id) 元组的字典

  • raise_for_changed_count – 分批拉取时,发现总数发生变化后,是否报错

  • app – 使用指定 app(设备)的接口

  • cooldown – 冷却时间,大于 0 时,两次接口调用之间至少间隔这么多秒

  • max_workers – 最大并发数,如果为 None 或 < 0 则自动确定,如果为 0 则单工作者惰性执行

  • already_stared – 说明所有 id 都已经打过星标,不用再次打星标

  • async – 是否异步

  • request_kwargs – 其它请求参数

Returns:

迭代器,产生详细的信息

p115client.tool.iterdir.iter_dirs(client: str | PathLike | P115Client, cid: int | str | Mapping = 0, id_to_dirnode: None | EllipsisType | MutableMapping[int, tuple[str, int]] = None, app: str = 'android', max_workers: None | int = 0, max_dirs: int | None = 0, *, async_: Literal[False] = False, **request_kwargs) Iterator[dict][source]
p115client.tool.iterdir.iter_dirs(client: str | PathLike | P115Client, cid: int | str | Mapping = 0, id_to_dirnode: None | EllipsisType | MutableMapping[int, tuple[str, int]] = None, app: str = 'android', max_workers: None | int = 0, max_dirs: int | None = 0, *, async_: Literal[True], **request_kwargs) AsyncIterator[dict]

遍历目录树,获取目录信息

Parameters:
  • client – 115 客户端或 cookies

  • cid – 目录 id 或 pickcode

  • id_to_dirnode – 字典,保存 id 到对应文件的 (name, parent_id) 元组的字典

  • app – 使用指定 app(设备)的接口

  • max_workers – 最大并发数,如果为 None 或 < 0 则自动确定,如果为 0 则单工作者惰性执行

  • max_dirs – 估计最大存在的目录数,<= 0 时则无限

  • async – 是否异步

  • request_kwargs – 其它请求参数

Returns:

迭代器,返回此目录内的(仅目录)文件信息

p115client.tool.iterdir.iter_dirs_with_path(client: str | PathLike | P115Client, cid: int | str | Mapping = 0, with_ancestors: bool = False, escape: None | bool | Callable[[str], str] = True, id_to_dirnode: None | EllipsisType | MutableMapping[int, tuple[str, int]] = None, app: str = 'android', max_workers: None | int = None, max_dirs: int | None = 0, *, async_: Literal[False] = False, **request_kwargs) Iterator[dict][source]
p115client.tool.iterdir.iter_dirs_with_path(client: str | PathLike | P115Client, cid: int | str | Mapping = 0, with_ancestors: bool = False, escape: None | bool | Callable[[str], str] = True, id_to_dirnode: None | EllipsisType | MutableMapping[int, tuple[str, int]] = None, app: str = 'android', max_workers: None | int = None, max_dirs: int | None = 0, *, async_: Literal[True], **request_kwargs) AsyncIterator[dict]

遍历目录树,获取目录信息

Parameters:
  • client – 115 客户端或 cookies

  • cid – 目录 id 或 pickcode

  • with_ancestors – 文件信息中是否要包含 “ancestors”

  • escape

    对文件名进行转义

    • 如果为 None,则不处理;否则,这个函数用来对文件名中某些符号进行转义,例如 “/” 等

    • 如果为 True,则使用 posixpatht.escape,会对文件名中 “/”,或单独出现的 “.” 和 “..” 用 “" 进行转义

    • 如果为 False,则使用 posix_escape_name 函数对名字进行转义,会把文件名中的 “/” 转换为 “|”

    • 如果为 Callable,则用你所提供的调用,以或者转义后的名字

  • id_to_dirnode – 字典,保存 id 到对应文件的 (name, parent_id) 元组的字典

  • app – 使用指定 app(设备)的接口

  • max_workers – 最大并发数,如果为 None 或 < 0 则自动确定,如果为 0 则单工作者惰性执行

  • max_dirs – 估计最大存在的目录数,<= 0 时则无限

  • async – 是否异步

  • request_kwargs – 其它请求参数

Returns:

迭代器,返回此目录内的(仅目录)文件信息

p115client.tool.iterdir.iter_dupfiles(client: str | PathLike | P115Client, cid: int | str | Mapping = 0, key: Callable[[dict], K] = itemgetter('sha1', 'size'), keep_first: None | bool | Callable[[dict], SupportsLT] = None, id_to_dirnode: None | EllipsisType | MutableMapping[int, tuple[str, int]] = None, max_workers: None | int = None, is_skim: bool = True, with_path: bool = False, app: str = 'android', *, async_: Literal[False] = False, **request_kwargs) Iterator[tuple[K, dict]][source]
p115client.tool.iterdir.iter_dupfiles(client: str | PathLike | P115Client, cid: int | str | Mapping = 0, key: Callable[[dict], K] = itemgetter('sha1', 'size'), keep_first: None | bool | Callable[[dict], SupportsLT] = None, id_to_dirnode: None | EllipsisType | MutableMapping[int, tuple[str, int]] = None, max_workers: None | int = None, is_skim: bool = True, with_path: bool = False, app: str = 'android', *, async_: Literal[True], **request_kwargs) AsyncIterator[tuple[K, dict]]

遍历以迭代获得所有重复文件

Parameters:
  • client – 115 客户端或 cookies

  • cid – 待被遍历的目录 id 或 pickcode

  • key – 函数,用来给文件分组,当多个文件被分配到同一组时,它们相互之间是重复文件关系

  • keep_first

    保留某个重复文件不输出,除此以外的重复文件都输出

    • 如果为 None,则输出所有重复文件(不作保留)

    • 如果是 Callable,则保留值最小的那个文件

    • 如果为 True,则保留最早入组的那个文件

    • 如果为 False,则保留最晚入组的那个文件

  • id_to_dirnode – 字典,保存 id 到对应文件的 (name, parent_id) 元组的字典

  • max_workers – 最大并发数,如果为 None 或 < 0 则自动确定,如果为 0 则单工作者惰性执行

  • is_skim – 是否拉取简要信息

  • with_path – 是否需要 “path” 和 “ancestors” 字段

  • app – 使用指定 app(设备)的接口

  • async – 是否异步

  • request_kwargs – 其它请求参数

Returns:

迭代器,返回 key 和 重复文件信息 的元组

p115client.tool.iterdir.iter_files(client: str | PathLike | P115Client | P115OpenClient, cid: int | str | Mapping = 0, page_size: int = 0, first_page_size: int = 0, suffix: str = '', type: Literal[1, 2, 3, 4, 5, 6, 7, 99] = 99, order: Literal['file_name', 'file_size', 'file_type', 'user_utime', 'user_ptime', 'user_otime'] = 'user_ptime', asc: Literal[0, 1] = 1, cur: Literal[0, 1] = 0, normalize_attr: None | Callable[[dict], dict] = normalize_attr, id_to_dirnode: None | EllipsisType | MutableMapping[int, tuple[str, int]] = None, raise_for_changed_count: bool = False, app: str = 'android', cooldown: None | float = None, max_workers: None | int = 0, *, async_: Literal[False] = False, **request_kwargs) Iterator[dict][source]
p115client.tool.iterdir.iter_files(client: str | PathLike | P115Client | P115OpenClient, cid: int | str | Mapping = 0, page_size: int = 0, first_page_size: int = 0, suffix: str = '', type: Literal[1, 2, 3, 4, 5, 6, 7, 99] = 99, order: Literal['file_name', 'file_size', 'file_type', 'user_utime', 'user_ptime', 'user_otime'] = 'user_ptime', asc: Literal[0, 1] = 1, cur: Literal[0, 1] = 0, normalize_attr: None | Callable[[dict], dict] = normalize_attr, id_to_dirnode: None | EllipsisType | MutableMapping[int, tuple[str, int]] = None, raise_for_changed_count: bool = False, app: str = 'android', cooldown: None | float = None, max_workers: None | int = 0, *, async_: Literal[True], **request_kwargs) AsyncIterator[dict]

遍历目录树,获取文件信息

Parameters:
  • client – 115 客户端或 cookies

  • cid – 目录 id 或 pickcode

  • page_size – 分页大小

  • first_page_size – 首次拉取的分页大小,如果 <= 0,则和 page_size 相同

  • suffix – 后缀名(优先级高于 type)

  • type

    文件类型

    • 1: 文档

    • 2: 图片

    • 3: 音频

    • 4: 视频

    • 5: 压缩包

    • 6: 应用

    • 7: 书籍

    • 99: 所有文件

  • order

    排序

    • ”file_name”: 文件名

    • ”file_size”: 文件大小

    • ”file_type”: 文件种类

    • ”user_utime”: 修改时间

    • ”user_ptime”: 创建时间

    • ”user_otime”: 上一次打开时间

  • asc – 升序排列。0: 否,1: 是

  • cur – 仅当前目录。0: 否(将遍历子目录树上所有叶子节点),1: 是

  • normalize_attr – 把数据进行转换处理,使之便于阅读

  • id_to_dirnode – 字典,保存 id 到对应文件的 (name, parent_id) 元组的字典

  • raise_for_changed_count – 分批拉取时,发现总数发生变化后,是否报错

  • app – 使用指定 app(设备)的接口

  • cooldown – 冷却时间,单位为秒。如果为 None,则用默认值(非并发时为 0,并发时为 1)

  • max_workers – 最大并发数,如果为 None 或 < 0 则自动确定,如果为 0 则单工作者惰性执行

  • async – 是否异步

  • request_kwargs – 其它请求参数

Returns:

迭代器,返回此目录内的(所有文件)文件信息

p115client.tool.iterdir.iter_files_frament(client: str | PathLike | P115Client, cid: int | str | Mapping = 0, page_size: int = 0, suffix: str = '', type: Literal[1, 2, 3, 4, 5, 6, 7, 99] = 99, auto_splitting_tasks: bool = True, auto_splitting_threshold: int = 300000, auto_splitting_statistics_timeout: None | int | float = 5, with_ancestors: bool = False, with_path: bool = False, escape: None | bool | Callable[[str], str] = True, normalize_attr: None | Callable[[dict], dict] = normalize_attr, id_to_dirnode: None | EllipsisType | MutableMapping[int, tuple[str, int]] = None, raise_for_changed_count: bool = False, app: str = 'web', cooldown: None | float = None, max_workers: None | int = None, *, async_: Literal[False] = False, **request_kwargs) Iterator[dict][source]
p115client.tool.iterdir.iter_files_frament(client: str | PathLike | P115Client, cid: int | str | Mapping = 0, page_size: int = 0, suffix: str = '', type: Literal[1, 2, 3, 4, 5, 6, 7, 99] = 99, auto_splitting_tasks: bool = True, auto_splitting_threshold: int = 300000, auto_splitting_statistics_timeout: None | int | float = 5, with_ancestors: bool = False, with_path: bool = False, escape: None | bool | Callable[[str], str] = True, normalize_attr: None | Callable[[dict], dict] = normalize_attr, id_to_dirnode: None | EllipsisType | MutableMapping[int, tuple[str, int]] = None, raise_for_changed_count: bool = False, app: str = 'web', cooldown: None | float = None, max_workers: None | int = None, *, async_: Literal[True], **request_kwargs) AsyncIterator[dict]

遍历目录树,获取文件信息(会根据统计信息,分解任务)

Parameters:
  • client – 115 客户端或 cookies

  • cid – 目录 id 或 pickcode

  • page_size – 分页大小

  • suffix – 后缀名(优先级高于 type)

  • type

    文件类型

    • 1: 文档

    • 2: 图片

    • 3: 音频

    • 4: 视频

    • 5: 压缩包

    • 6: 应用

    • 7: 书籍

    • 99: 所有文件

  • auto_splitting_tasks – 是否根据统计信息自动拆分任务

  • auto_splitting_threshold – 如果 auto_splitting_tasks 为 True,且目录内的文件数大于 auto_splitting_threshold,则分拆此任务到它的各个直接子目录,否则批量拉取

  • auto_splitting_statistics_timeout – 如果执行统计超过此时间,则立即终止,并认为文件是无限多

  • with_ancestors – 文件信息中是否要包含 “ancestors”

  • with_path – 文件信息中是否要包含 “path”

  • escape

    对文件名进行转义

    • 如果为 None,则不处理;否则,这个函数用来对文件名中某些符号进行转义,例如 “/” 等

    • 如果为 True,则使用 posixpatht.escape,会对文件名中 “/”,或单独出现的 “.” 和 “..” 用 “" 进行转义

    • 如果为 False,则使用 posix_escape_name 函数对名字进行转义,会把文件名中的 “/” 转换为 “|”

    • 如果为 Callable,则用你所提供的调用,以或者转义后的名字

  • normalize_attr – 把数据进行转换处理,使之便于阅读

  • id_to_dirnode – 字典,保存 id 到对应文件的 (name, parent_id) 元组的字典

  • app – 使用指定 app(设备)的接口

  • cooldown – 冷却时间,单位为秒。如果为 None,则用默认值(非并发时为 0,并发时为 1)

  • raise_for_changed_count – 分批拉取时,发现总数发生变化后,是否报错

  • async – 是否异步

  • request_kwargs – 其它请求参数

Returns:

迭代器,返回此目录内的(所有文件)文件信息

p115client.tool.iterdir.iter_files_shortcut(client: str | PathLike | P115Client, cid: int | str | Mapping = 0, id_to_dirnode: None | EllipsisType | MutableMapping[int, tuple[str, int]] = None, max_workers: None | int = None, is_skim: bool = True, with_path: bool = False, app: str = 'android', *, async_: Literal[False] = False, **request_kwargs) Iterator[dict][source]
p115client.tool.iterdir.iter_files_shortcut(client: str | PathLike | P115Client, cid: int | str | Mapping = 0, id_to_dirnode: None | EllipsisType | MutableMapping[int, tuple[str, int]] = None, max_workers: None | int = None, is_skim: bool = True, with_path: bool = False, app: str = 'android', *, async_: Literal[True], **request_kwargs) AsyncIterator[dict]

遍历目录树,获取(所有文件而非目录)文件信息(整合了多个函数的入口)

Note

is_skimwith_path 的不同取值组合,会决定采用不同的函数:

  1. iter_download_nodes: is_skim=True and with_path=False

  2. iter_files_with_path_skim: is_skim=True and with_path=True

  3. iter_files: is_skim=False and with_path=False

  4. iter_files_with_path: is_skim=False and with_path=True

Parameters:
  • client – 115 客户端或 cookies

  • cid – 待被遍历的目录 id 或 pickcode

  • id_to_dirnode – 字典,保存 id 到对应文件的 (name, parent_id) 元组的字典

  • max_workers – 最大并发数,如果为 None 或 < 0 则自动确定,如果为 0 则单工作者惰性执行

  • is_skim – 是否拉取简要信息

  • with_path – 是否需要 “path” 和 “ancestors” 字段

  • app – 使用指定 app(设备)的接口

  • async – 是否异步

  • request_kwargs – 其它请求参数

Returns:

迭代器,产生文件信息

p115client.tool.iterdir.iter_files_with_path(client: str | PathLike | P115Client, cid: int | str | Mapping = 0, page_size: int = 0, suffix: str = '', type: Literal[1, 2, 3, 4, 5, 6, 7, 99] = 99, order: Literal['file_name', 'file_size', 'file_type', 'user_utime', 'user_ptime', 'user_otime'] = 'user_ptime', asc: Literal[0, 1] = 1, cur: Literal[0, 1] = 0, normalize_attr: None | Callable[[dict], dict] = normalize_attr, escape: None | bool | Callable[[str], str] = True, with_ancestors: bool = False, id_to_dirnode: None | EllipsisType | MutableMapping[int, tuple[str, int]] = None, path_already: bool = False, raise_for_changed_count: bool = False, app: str = 'android', cooldown: None | float = 0.5, max_workers: None | int = None, max_dirs: int | None = 0, *, async_: Literal[False] = False, **request_kwargs) Iterator[dict][source]
p115client.tool.iterdir.iter_files_with_path(client: str | PathLike | P115Client, cid: int | str | Mapping = 0, page_size: int = 0, suffix: str = '', type: Literal[1, 2, 3, 4, 5, 6, 7, 99] = 99, order: Literal['file_name', 'file_size', 'file_type', 'user_utime', 'user_ptime', 'user_otime'] = 'user_ptime', asc: Literal[0, 1] = 1, cur: Literal[0, 1] = 0, normalize_attr: None | Callable[[dict], dict] = normalize_attr, escape: None | bool | Callable[[str], str] = True, with_ancestors: bool = False, id_to_dirnode: None | EllipsisType | MutableMapping[int, tuple[str, int]] = None, path_already: bool = False, raise_for_changed_count: bool = False, app: str = 'android', cooldown: None | float = 0.5, max_workers: None | int = None, max_dirs: int | None = 0, *, async_: Literal[True], **request_kwargs) AsyncIterator[dict]

遍历目录树,获取文件信息(包含 “path”,可选 “ancestors”)

Parameters:
  • client – 115 客户端或 cookies

  • cid – 目录 id 或 pickcode

  • page_size – 分页大小

  • suffix – 后缀名(优先级高于 type)

  • type

    文件类型

    • 1: 文档

    • 2: 图片

    • 3: 音频

    • 4: 视频

    • 5: 压缩包

    • 6: 应用

    • 7: 书籍

    • 99: 所有文件

  • order

    排序

    • ”file_name”: 文件名

    • ”file_size”: 文件大小

    • ”file_type”: 文件种类

    • ”user_utime”: 修改时间

    • ”user_ptime”: 创建时间

    • ”user_otime”: 上一次打开时间

  • asc – 升序排列。0: 否,1: 是

  • cur – 仅当前目录。0: 否(将遍历子目录树上所有叶子节点),1: 是

  • normalize_attr – 把数据进行转换处理,使之便于阅读

  • escape

    对文件名进行转义

    • 如果为 None,则不处理;否则,这个函数用来对文件名中某些符号进行转义,例如 “/” 等

    • 如果为 True,则使用 posixpatht.escape,会对文件名中 “/”,或单独出现的 “.” 和 “..” 用 “" 进行转义

    • 如果为 False,则使用 posix_escape_name 函数对名字进行转义,会把文件名中的 “/” 转换为 “|”

    • 如果为 Callable,则用你所提供的调用,以或者转义后的名字

  • with_ancestors – 文件信息中是否要包含 “ancestors”

  • id_to_dirnode – 字典,保存 id 到对应文件的 (name, parent_id) 元组的字典

  • path_already – 如果为 True,则说明 id_to_dirnode 中已经具备构建路径所需要的目录节点,所以不会再去拉取目录节点的信息

  • raise_for_changed_count – 分批拉取时,发现总数发生变化后,是否报错

  • app – 使用指定 app(设备)的接口

  • cooldown – 冷却时间,单位为秒。如果为 None,则用默认值(非并发时为 0,并发时为 1)

  • max_workers – 最大并发数,如果为 None 或 < 0 则自动确定,如果为 0 则单工作者惰性执行

  • max_dirs – 估计最大存在的目录数,<= 0 时则无限

  • async – 是否异步

  • request_kwargs – 其它请求参数

Returns:

迭代器,返回此目录内的(所有文件)文件信息

p115client.tool.iterdir.iter_files_with_path_skim(client: str | PathLike | P115Client, cid: int | str | Mapping = 0, escape: None | bool | Callable[[str], str] = True, with_ancestors: bool = False, id_to_dirnode: None | EllipsisType | MutableMapping[int, tuple[str, int]] = None, path_already: bool = False, max_workers: None | int = None, max_files: int | None = 0, max_dirs: int | None = 0, app: str = 'android', *, async_: Literal[False] = False, **request_kwargs) Iterator[dict][source]
p115client.tool.iterdir.iter_files_with_path_skim(client: str | PathLike | P115Client, cid: int | str | Mapping = 0, escape: None | bool | Callable[[str], str] = True, with_ancestors: bool = False, id_to_dirnode: None | EllipsisType | MutableMapping[int, tuple[str, int]] = None, path_already: bool = False, max_workers: None | int = None, max_files: int | None = 0, max_dirs: int | None = 0, app: str = 'android', *, async_: Literal[True], **request_kwargs) AsyncIterator[dict]

遍历目录树,获取文件信息(包含 “path”,可选 “ancestors”)

Parameters:
  • client – 115 客户端或 cookies

  • cid – 目录 id 或 pickcode

  • escape

    对文件名进行转义

    • 如果为 None,则不处理;否则,这个函数用来对文件名中某些符号进行转义,例如 “/” 等

    • 如果为 True,则使用 posixpatht.escape,会对文件名中 “/”,或单独出现的 “.” 和 “..” 用 “" 进行转义

    • 如果为 False,则使用 posix_escape_name 函数对名字进行转义,会把文件名中的 “/” 转换为 “|”

    • 如果为 Callable,则用你所提供的调用,以或者转义后的名字

  • with_ancestors – 文件信息中是否要包含 “ancestors”

  • id_to_dirnode – 字典,保存 id 到对应文件的 (name, parent_id) 元组的字典

  • path_already – 如果为 True,则说明 id_to_dirnode 中已经具备构建路径所需要的目录节点,所以不会再去拉取目录节点的信息

  • max_workers – 最大并发数,如果为 None 或 < 0 则自动确定,如果为 0 则单工作者惰性执行

  • max_files – 估计最大存在的文件数,<= 0 时则无限

  • max_dirs – 估计最大存在的目录数,<= 0 时则无限

  • app – 使用指定 app(设备)的接口

  • async – 是否异步

  • request_kwargs – 其它请求参数

Returns:

迭代器,返回此目录内的(所有文件)文件信息

p115client.tool.iterdir.iter_id_to_dirnode(key: int | str | PathLike | P115Client | P115OpenClient) Iterator[tuple[int, DirNode]][source]

用指定 key 查询缓存 p115client.const.ID_TO_DIRNODE_CACHE,迭代返回结果

Parameters:

key – 分享码或者用户 id(或者 115 客户端或 cookies,然后间接获取用户 id)

Returns:

迭代器,产生文件或目录的 id 到对应的 (name, parent_id) 元组

p115client.tool.iterdir.iter_media_files(client: str | PathLike | P115Client, cid: int | str | Mapping = 0, page_size: int = 8192, type: Literal[0, 1, 2, 3, 4, 5, 6, 7, 99] = 0, order: Literal['file_name', 'file_size', 'file_type', 'user_utime', 'user_ptime', 'user_otime'] = 'user_ptime', asc: Literal[0, 1] = 1, cur: Literal[0, 1] = 0, raise_for_changed_count: bool = False, *, async_: Literal[False] = False, **request_kwargs) Iterator[dict][source]
p115client.tool.iterdir.iter_media_files(client: str | PathLike | P115Client, cid: int | str | Mapping = 0, page_size: int = 8192, type: Literal[0, 1, 2, 3, 4, 5, 6, 7, 99] = 0, order: Literal['file_name', 'file_size', 'file_type', 'user_utime', 'user_ptime', 'user_otime'] = 'user_ptime', asc: Literal[0, 1] = 1, cur: Literal[0, 1] = 0, raise_for_changed_count: bool = False, *, async_: Literal[True], **request_kwargs) AsyncIterator[dict]

遍历目录树,获取文件信息(如果是图片,则包含图片的 CDN 链接)

Tip

这个函数的效果相当于 iter_files(client, cid, type=type, ...) 所获取的文件列表,只是返回信息有些不同,速度似乎还是 iter_files 更快

Parameters:
  • client – 115 客户端或 cookies

  • cid – 目录 id 或 pickcode

  • page_size – 分页大小

  • type

    文件类型

    • 0: 相当于 2,即获取图片,但用一个单独的接口

    • 1: 文档

    • 2: 图片

    • 3: 音频

    • 4: 视频

    • 5: 压缩包

    • 6: 应用

    • 7: 书籍

    • 99: 所有文件

  • order

    排序

    • ”file_name”: 文件名

    • ”file_size”: 文件大小

    • ”file_type”: 文件种类

    • ”user_utime”: 修改时间

    • ”user_ptime”: 创建时间

    • ”user_otime”: 上一次打开时间

  • asc – 升序排列。0: 否,1: 是

  • cur – 仅当前目录。0: 否(将遍历子目录树上所有叶子节点),1: 是

  • raise_for_changed_count – 分批拉取时,发现总数发生变化后,是否报错

  • async – 是否异步

  • request_kwargs – 其它请求参数

Returns:

迭代器,返回此目录内的图片文件信息

p115client.tool.iterdir.iter_nodes(client: str | PathLike | P115Client, ids: Iterable[int | str], ignore_deleted: bool = False, normalize_attr: None | Callable[[dict], dict] = normalize_attr, id_to_dirnode: None | EllipsisType | MutableMapping[int, tuple[str, int]] = None, max_workers: None | int = 0, *, async_: Literal[False] = False, **request_kwargs) Iterator[dict][source]
p115client.tool.iterdir.iter_nodes(client: str | PathLike | P115Client, ids: Iterable[int | str], ignore_deleted: bool = False, normalize_attr: None | Callable[[dict], dict] = normalize_attr, id_to_dirnode: None | EllipsisType | MutableMapping[int, tuple[str, int]] = None, max_workers: None | int = 0, *, async_: Literal[True], **request_kwargs) AsyncIterator[dict]

获取一组 id 的信息

Caution

风控比较严重,请谨慎使用

Parameters:
  • client – 115 客户端或 cookies

  • ids – 一组文件或目录的 id

  • ignore_deleted – 忽略已经被删除的

  • normalize_attr – 把数据进行转换处理,使之便于阅读

  • id_to_dirnode – 字典,保存 id 到对应文件的 (name, parent_id) 元组的字典,如果为 …,则忽略

  • max_workers – 最大并发数,如果为 None 或 < 0 则自动确定,如果为 0 则单工作者惰性执行

  • async – 是否异步

  • request_kwargs – 其它请求参数

Returns:

迭代器,产生详细的信息

p115client.tool.iterdir.iter_nodes_by_pickcode(client: str | PathLike | P115Client, pickcodes: Iterable[str | int], ignore_deleted: None | bool = False, normalize_attr: None | Callable[[dict], dict] = None, id_to_dirnode: None | EllipsisType | MutableMapping[int, tuple[str, int]] = None, max_workers: None | int = 0, *, async_: Literal[False] = False, **request_kwargs) Iterator[dict][source]
p115client.tool.iterdir.iter_nodes_by_pickcode(client: str | PathLike | P115Client, pickcodes: Iterable[str | int], ignore_deleted: None | bool = False, normalize_attr: None | Callable[[dict], dict] = None, id_to_dirnode: None | EllipsisType | MutableMapping[int, tuple[str, int]] = None, max_workers: None | int = 0, *, async_: Literal[True], **request_kwargs) AsyncIterator[dict]

获取一组 id 的信息

Caution

并发数较多时,容易发生 HTTP 链接中断现象

Parameters:
  • client – 115 客户端或 cookies

  • pickcodes – 一组文件或目录的 pickcode 或 id

  • ignore_deleted – 是否忽略已经被删除的

  • normalize_attr – 把数据进行转换处理,使之便于阅读

  • id_to_dirnode – 字典,保存 id 到对应文件的 (name, parent_id) 元组的字典,如果为 …,则忽略

  • max_workers – 最大并发数,如果为 None 或 < 0 则自动确定,如果为 0 则单工作者惰性执行

  • async – 是否异步

  • request_kwargs – 其它请求参数

Returns:

迭代器,产生详细的信息

p115client.tool.iterdir.iter_nodes_skim(client: str | PathLike | P115Client, ids: Iterable[int | str], batch_size: int = 50000, max_workers: None | int = 0, *, async_: Literal[False] = False, **request_kwargs) Iterator[dict][source]
p115client.tool.iterdir.iter_nodes_skim(client: str | PathLike | P115Client, ids: Iterable[int | str], batch_size: int = 50000, max_workers: None | int = 0, *, async_: Literal[True], **request_kwargs) AsyncIterator[dict]

获取一组节点的简略信息

Parameters:
  • client – 115 客户端或 cookies

  • ids – 一组文件或目录的 id 或 pickcode

  • batch_size – 批次大小,分批次,每次提交的 id 数

  • max_workers – 最大并发数,如果为 None 或 < 0 则自动确定,如果为 0 则单工作者惰性执行

  • async – 是否异步

  • request_kwargs – 其它请求参数

Returns:

迭代器,获取节点的简略信息

p115client.tool.iterdir.iter_nodes_using_event(client: str | PathLike | P115Client, ids: Iterable[int | str], type: Literal['doc', 'img'] = 'img', normalize_attr: None | bool | Callable[[dict], dict] = True, id_to_dirnode: None | EllipsisType | MutableMapping[int, tuple[str, int]] = None, app: str = 'android', cooldown: float = 0, *, async_: Literal[False] = False, **request_kwargs) Iterator[dict][source]
p115client.tool.iterdir.iter_nodes_using_event(client: str | PathLike | P115Client, ids: Iterable[int | str], type: Literal['doc', 'img'] = 'img', normalize_attr: None | bool | Callable[[dict], dict] = True, id_to_dirnode: None | EllipsisType | MutableMapping[int, tuple[str, int]] = None, app: str = 'android', cooldown: float = 0, *, async_: Literal[True], **request_kwargs) AsyncIterator[dict]

通过先发送事件,然后收集这个事件,来获取一组 id 的信息

Note

如果未收集到事件,则说明文件 id 不存在或者已删除,你也可以因此找出所有的无效 id

Parameters:
  • client – 115 客户端或 cookies

  • ids – 一组文件或目录的 id 或 pickcode

  • type

    事件类型

    • ”doc”: 推送 “browse_document” 事件

    • ”img”: 推送 “browse_image” 事件

  • normalize_attr – 把数据进行转换处理,使之便于阅读

  • id_to_dirnode – 字典,保存 id 到对应文件的 (name, parent_id) 元组的字典,如果为 …,则忽略

  • app – 使用指定 app(设备)的接口

  • cooldown – 冷却时间,大于 0 时,两次拉取操作事件的接口调用之间至少间隔这么多秒

  • async – 是否异步

  • request_kwargs – 其它请求参数

Returns:

迭代器,产生简略的信息

{
    "id": int,
    "parent_id": int,
    "name": str,
    "is_dir": 0 | 1,
    "pickcode": str,
    "sha1": str,
    "size": int,
    "star": 0 | 1,
    "labels": list[dict],
    "ftype": int,
    "type": int,
}

p115client.tool.iterdir.iter_nodes_using_info(client: str | PathLike | P115Client | P115OpenClient, ids: Iterable[int | str], id_to_dirnode: None | EllipsisType | MutableMapping[int, tuple[str, int]] = None, max_workers: None | int = 0, app: str = '', *, async_: Literal[False] = False, **request_kwargs) Iterator[dict][source]
p115client.tool.iterdir.iter_nodes_using_info(client: str | PathLike | P115Client | P115OpenClient, ids: Iterable[int | str], id_to_dirnode: None | EllipsisType | MutableMapping[int, tuple[str, int]] = None, max_workers: None | int = 0, app: str = '', *, async_: Literal[True], **request_kwargs) AsyncIterator[dict]

获取一组 id 的信息

Caution

风控比较严重,且速度较慢,请斟酌使用

Parameters:
  • client – 115 客户端或 cookies

  • ids – 一组文件或目录的 id

  • id_to_dirnode – 字典,保存 id 到对应文件的 (name, parent_id) 元组的字典,如果为 …,则忽略

  • max_workers – 最大并发数,如果为 None 或 < 0 则自动确定,如果为 0 则单工作者惰性执行

  • app – 使用指定 app(设备)的接口

  • async – 是否异步

  • request_kwargs – 其它请求参数

Returns:

迭代器,产生详细的信息

p115client.tool.iterdir.iter_nodes_using_update(client: str | PathLike | P115Client, ids: Iterable[int | str], ignore_deleted: None | bool = False, id_to_dirnode: None | EllipsisType | MutableMapping[int, tuple[str, int]] = None, max_workers: None | int = 0, *, async_: Literal[False] = False, **request_kwargs) Iterator[dict][source]
p115client.tool.iterdir.iter_nodes_using_update(client: str | PathLike | P115Client, ids: Iterable[int | str], ignore_deleted: None | bool = False, id_to_dirnode: None | EllipsisType | MutableMapping[int, tuple[str, int]] = None, max_workers: None | int = 0, *, async_: Literal[True], **request_kwargs) AsyncIterator[dict]

获取一组 id 的信息

Caution

风控比较严重,且速度较慢,请斟酌使用

Parameters:
  • client – 115 客户端或 cookies

  • ids – 一组文件或目录的 id 或 pickcode

  • ignore_deleted – 是否忽略已经被删除的

  • id_to_dirnode – 字典,保存 id 到对应文件的 (name, parent_id) 元组的字典,如果为 …,则忽略

  • max_workers – 最大并发数,如果为 None 或 < 0 则自动确定,如果为 0 则单工作者惰性执行

  • async – 是否异步

  • request_kwargs – 其它请求参数

Returns:

迭代器,产生详细的信息

p115client.tool.iterdir.iter_parents(client: str | PathLike | P115Client, ids: Iterable[int], max_workers: None | int = None, *, async_: Literal[False] = False, **request_kwargs) Iterator[tuple[int, tuple[str, str, str]]][source]
p115client.tool.iterdir.iter_parents(client: str | PathLike | P115Client, ids: Iterable[int] | AsyncIterable[int], max_workers: None | int = None, *, async_: Literal[True], **request_kwargs) AsyncIterator[tuple[int, tuple[str, str, str]]]

获取一批 id 的上级目录,最多获取 3 级(不包括被查询的 id 自身这一级)

Parameters:
  • client – 115 客户端或 cookies

  • ids – 一批文件或目录的 id

  • max_workers – 最大并发数,如果为 None 或 < 0 则自动确定,如果为 0 则单工作者惰性执行

  • async – 是否异步

  • request_kwargs – 其它请求参数

Returns:

迭代器,产生 id 和 最近 3 级目录名的元组的 2 元组

p115client.tool.iterdir.iter_stared_dirs(client: str | PathLike | P115Client | P115OpenClient, page_size: int = 0, first_page_size: int = 0, order: Literal['file_name', 'file_size', 'file_type', 'user_utime', 'user_ptime', 'user_otime'] = 'user_ptime', asc: Literal[0, 1] = 1, normalize_attr: None | Callable[[dict], dict] = normalize_attr, id_to_dirnode: None | EllipsisType | MutableMapping[int, tuple[str, int]] = None, raise_for_changed_count: bool = False, app: str = 'android', cooldown: None | float = None, max_workers: None | int = 0, *, async_: Literal[False] = False, **request_kwargs) Iterator[dict][source]
p115client.tool.iterdir.iter_stared_dirs(client: str | PathLike | P115Client | P115OpenClient, page_size: int = 0, first_page_size: int = 0, order: Literal['file_name', 'file_size', 'file_type', 'user_utime', 'user_ptime', 'user_otime'] = 'user_ptime', asc: Literal[0, 1] = 1, normalize_attr: None | Callable[[dict], dict] = normalize_attr, id_to_dirnode: None | EllipsisType | MutableMapping[int, tuple[str, int]] = None, raise_for_changed_count: bool = False, app: str = 'android', cooldown: None | float = None, max_workers: None | int = 0, *, async_: Literal[True], **request_kwargs) AsyncIterator[dict]

遍历以迭代获得所有被打上星标的目录信息

Parameters:
  • client – 115 客户端或 cookies

  • page_size – 分页大小

  • first_page_size – 首次拉取的分页大小,如果 <= 0,则和 page_size 相同

  • order

    排序

    • ”file_name”: 文件名

    • ”file_size”: 文件大小

    • ”file_type”: 文件种类

    • ”user_utime”: 修改时间

    • ”user_ptime”: 创建时间

    • ”user_otime”: 上一次打开时间

  • asc – 升序排列。0: 否,1: 是

  • normalize_attr – 把数据进行转换处理,使之便于阅读

  • id_to_dirnode – 字典,保存 id 到对应文件的 (name, parent_id) 元组的字典

  • raise_for_changed_count – 分批拉取时,发现总数发生变化后,是否报错

  • app – 使用指定 app(设备)的接口

  • cooldown – 冷却时间,单位为秒。如果为 None,则用默认值(非并发时为 0,并发时为 1)

  • max_workers – 最大并发数,如果为 None 或 < 0 则自动确定,如果为 0 则单工作者惰性执行

  • async – 是否异步

  • request_kwargs – 其它请求参数

Returns:

迭代器,被打上星标的目录信息

p115client.tool.iterdir.iterdir(client: str | PathLike | P115Client | P115OpenClient, cid: int | str | Mapping = 0, page_size: int = 0, first_page_size: int = 0, start: int = 0, order: Literal['file_name', 'file_size', 'file_type', 'user_utime', 'user_ptime', 'user_otime'] = 'user_ptime', asc: Literal[0, 1] = 1, show_dir: Literal[0, 1] = 1, fc_mix: Literal[0, 1] = 1, normalize_attr: None | Callable[[dict], dict] = normalize_attr, id_to_dirnode: None | EllipsisType | MutableMapping[int, tuple[str, int]] = None, raise_for_changed_count: bool = False, ensure_file: None | bool = None, hold_top: bool = False, escape: None | bool | Callable[[str], str] = True, app: str = 'android', cooldown: None | float = None, max_workers: None | int = 0, *, async_: Literal[False] = False, **request_kwargs) Iterator[dict][source]
p115client.tool.iterdir.iterdir(client: str | PathLike | P115Client | P115OpenClient, cid: int | str | Mapping = 0, page_size: int = 0, first_page_size: int = 0, start: int = 0, order: Literal['file_name', 'file_size', 'file_type', 'user_utime', 'user_ptime', 'user_otime'] = 'user_ptime', asc: Literal[0, 1] = 1, show_dir: Literal[0, 1] = 1, fc_mix: Literal[0, 1] = 1, normalize_attr: None | Callable[[dict], dict] = normalize_attr, id_to_dirnode: None | EllipsisType | MutableMapping[int, tuple[str, int]] = None, raise_for_changed_count: bool = False, ensure_file: None | bool = None, hold_top: bool = False, escape: None | bool | Callable[[str], str] = True, app: str = 'android', cooldown: None | float = None, max_workers: None | int = 0, *, async_: Literal[True], **request_kwargs) AsyncIterator[dict]

迭代目录,获取文件信息

Parameters:
  • client – 115 客户端或 cookies

  • cid – 目录 id 或 pickcode

  • page_size – 分页大小

  • first_page_size – 首次拉取的分页大小,如果 <= 0,则和 page_size 相同

  • start – 开始索引,从 0 开始

  • order

    排序

    • ”file_name”: 文件名

    • ”file_size”: 文件大小

    • ”file_type”: 文件种类

    • ”user_utime”: 修改时间

    • ”user_ptime”: 创建时间

    • ”user_otime”: 上一次打开时间

  • asc – 升序排列。0: 否,1: 是

  • show_dir – 展示文件夹。0: 否,1: 是

  • fc_mix – 文件夹置顶。0: 文件夹在文件之前,1: 文件和文件夹混合并按指定排序

  • normalize_attr – 把数据进行转换处理,使之便于阅读

  • id_to_dirnode – 字典,保存 id 到对应文件的 (name, parent_id) 元组的字典

  • raise_for_changed_count – 分批拉取时,发现总数发生变化后,是否报错

  • ensure_file

    是否确保为文件

    • True: 必须是文件

    • False: 必须是目录

    • None: 可以是目录或文件

  • hold_top – 保留顶层目录信息,返回字段增加 “top_id”, “top_ancestors”, “top_path”

  • escape

    对文件名进行转义

    • 如果为 None,则不处理;否则,这个函数用来对文件名中某些符号进行转义,例如 “/” 等

    • 如果为 True,则使用 posixpatht.escape,会对文件名中 “/”,或单独出现的 “.” 和 “..” 用 “" 进行转义

    • 如果为 False,则使用 posix_escape_name 函数对名字进行转义,会把文件名中的 “/” 转换为 “|”

    • 如果为 Callable,则用你所提供的调用,以或者转义后的名字

  • app – 使用指定 app(设备)的接口

  • cooldown – 冷却时间,单位为秒。如果为 None,则用默认值(非并发时为 0,并发时为 1)

  • max_workers – 最大并发数,如果为 None 或 < 0 则自动确定,如果为 0 则单工作者惰性执行

  • async – 是否异步

  • request_kwargs – 其它请求参数

Returns:

迭代器,返回此目录内的文件信息(文件和目录)

p115client.tool.iterdir.iterdir_traverse(client: str | PathLike | P115Client | P115OpenClient, cid: int | str | Mapping = 0, topdown: None | bool = True, min_depth: int = 1, max_depth: int = -1, predicate: None | bool | Callable[[dict], Any] = None, onerror: bool | Callable[[OSError], Any] = False, normalize_attr: Callable[[dict], dict] = normalize_attr, id_to_dirnode: None | EllipsisType | MutableMapping[int, tuple[str, int]] = None, raise_for_changed_count: bool = False, app: str = 'android', cooldown: None | float = None, *, async_: Literal[False] = False, **request_kwargs) Iterator[dict][source]
p115client.tool.iterdir.iterdir_traverse(client: str | PathLike | P115Client | P115OpenClient, cid: int | str | Mapping = 0, topdown: None | bool = True, min_depth: int = 1, max_depth: int = -1, predicate: None | bool | Callable[[dict], Any] = None, onerror: bool | Callable[[OSError], Any] = False, normalize_attr: Callable[[dict], dict] = normalize_attr, id_to_dirnode: None | EllipsisType | MutableMapping[int, tuple[str, int]] = None, raise_for_changed_count: bool = False, app: str = 'android', cooldown: None | float = None, *, async_: Literal[True], **request_kwargs) AsyncIterator[dict]

迭代目录树,获取文件信息

Attention

这个函数不支持并发,而且是对罗列目录接口的循环调用,所以速度会比较慢,而且也容易被风控(可以设置 cooldown 以限制接口调用频率)

Parameters:
  • client – 115 客户端或 cookies

  • cid – 目录 id 或 pickcode

  • topdown – 如果是 True,自顶向下深度优先搜索;如果是 False,自底向上深度优先搜索;如果是 None,广度优先搜索

  • min_depth – 最小深度,top 本身为 0

  • max_depth – 最大深度,< 0 时不限

  • predicate

    调用以筛选遍历得到的路径

    • 如果为 None,则不做筛选

    • 如果为 True,则只输出文件

    • 如果为 False,则只输出目录

    • 否则,就是 Callable。对于返回值
      • 如果为 True,则输出它,且会继续搜索它的子树

      • 如果为 False,则跳过它,但会继续搜索它的子树

      • 如果为 1,则输出它,但跳过它的子树

      • 如果为 0,则跳过它,且跳过它的子树

  • onerror – 处理 OSError 异常。如果是 True,抛出异常;如果是 False,忽略异常;如果是调用,以异常为参数调用之

  • normalize_attr – 把数据进行转换处理,使之便于阅读

  • id_to_dirnode – 字典,保存 id 到对应文件的 (name, parent_id) 元组的字典

  • raise_for_changed_count – 分批拉取时,发现总数发生变化后,是否报错

  • app – 使用指定 app(设备)的接口

  • cooldown – 冷却时间,单位为秒。如果为 None,则用默认值(非并发时为 0,并发时为 1)

  • async – 是否异步

  • request_kwargs – 其它请求参数

Returns:

迭代器,返回此目录内的文件信息(文件和目录)

p115client.tool.iterdir.iterdir_walk(client: str | PathLike | P115Client | P115OpenClient, cid: int | str | Mapping = 0, topdown: None | bool = True, min_depth: int = 1, max_depth: int = -1, onerror: bool | Callable[[OSError], Any] = False, normalize_attr: Callable[[dict], dict] = normalize_attr, id_to_dirnode: None | EllipsisType | MutableMapping[int, tuple[str, int]] = None, raise_for_changed_count: bool = False, app: str = 'android', cooldown: None | float = None, *, async_: Literal[False] = False, **request_kwargs) Iterator[tuple[int, list[dict], list[dict]]][source]
p115client.tool.iterdir.iterdir_walk(client: str | PathLike | P115Client | P115OpenClient, cid: int | str | Mapping = 0, topdown: None | bool = True, min_depth: int = 1, max_depth: int = -1, onerror: bool | Callable[[OSError], Any] = False, normalize_attr: Callable[[dict], dict] = normalize_attr, id_to_dirnode: None | EllipsisType | MutableMapping[int, tuple[str, int]] = None, raise_for_changed_count: bool = False, app: str = 'android', cooldown: None | float = None, *, async_: Literal[True], **request_kwargs) AsyncIterator[tuple[int, list[dict], list[dict]]]

迭代目录树,获取文件信息

Attention

这个函数不支持并发,而且是对罗列目录接口的循环调用,所以速度会比较慢,而且也容易被风控(可以设置 cooldown 以限制接口调用频率)

Parameters:
  • client – 115 客户端或 cookies

  • cid – 目录 id 或 pickcode

  • topdown – 如果是 True,自顶向下深度优先搜索;如果是 False,自底向上深度优先搜索;如果是 None,广度优先搜索

  • min_depth – 最小深度,top 本身为 0

  • max_depth – 最大深度,< 0 时不限

  • onerror – 处理 OSError 异常。如果是 True,抛出异常;如果是 False,忽略异常;如果是调用,以异常为参数调用之

  • normalize_attr – 把数据进行转换处理,使之便于阅读

  • id_to_dirnode – 字典,保存 id 到对应文件的 (name, parent_id) 元组的字典

  • raise_for_changed_count – 分批拉取时,发现总数发生变化后,是否报错

  • app – 使用指定 app(设备)的接口

  • cooldown – 冷却时间,单位为秒。如果为 None,则用默认值(非并发时为 0,并发时为 1)

  • async – 是否异步

  • request_kwargs – 其它请求参数

Returns:

迭代器,产生 (pid, 目录信息列表, 文件信息列表) 元组

p115client.tool.iterdir.search_iter(client: str | PathLike | P115Client | P115OpenClient, search_value: str = '.', cid: int | str | Mapping = 0, suffix: str = '', type: int = 0, offset: int = 0, page_size: int = 115, normalize_attr: None | Callable[[dict], dict] = normalize_attr, app: str = 'web', *, async_: Literal[False] = False, **request_kwargs) Iterator[dict][source]
p115client.tool.iterdir.search_iter(client: str | PathLike | P115Client | P115OpenClient, search_value: str = '.', cid: int | str | Mapping = 0, suffix: str = '', type: int = 0, offset: int = 0, page_size: int = 115, normalize_attr: None | Callable[[dict], dict] = normalize_attr, app: str = 'web', *, async_: Literal[True], **request_kwargs) AsyncIterator[dict]

搜索然后迭代返回结果

Attention

最多可取回 10,000,但接口有 bug,即使总数 >= 10,000,能取回的往往少于 10,000

Parameters:
  • client – 115 客户端或 cookies

  • search_value – 搜索关键词,搜索到的文件名必须包含这个字符串

  • cid – 目录 id 或 pickcode

  • suffix – 后缀名(优先级高于 type)

  • type

    文件类型

    • 1: 文档

    • 2: 图片

    • 3: 音频

    • 4: 视频

    • 5: 压缩包

    • 6: 应用

    • 7: 书籍

    • 99: 所有文件

  • offset – 开始索引,从 0 开始,要求 <= 10,000

  • page_size – 分页大小,要求 offset + page_size <= 10,000

  • normalize_attr – 把数据进行转换处理,使之便于阅读

  • app – 使用指定 app(设备)的接口

  • async – 是否异步

  • request_kwargs – 其它请求参数

Returns:

返回文件信息,如果没有,则是 None

p115client.tool.iterdir.share_iter_files(client: str | PathLike | P115Client, share_code: str, receive_code: str = '', cid: int | Mapping = 0, id_to_dirnode: None | EllipsisType | MutableMapping[int, tuple[str, int]] = None, app: str = 'android', *, async_: Literal[False] = False, **request_kwargs) Iterator[dict][source]
p115client.tool.iterdir.share_iter_files(client: str | PathLike | P115Client, share_code: str, receive_code: str = '', cid: int | Mapping = 0, id_to_dirnode: None | EllipsisType | MutableMapping[int, tuple[str, int]] = None, app: str = 'android', *, async_: Literal[True], **request_kwargs) AsyncIterator[dict]

批量获取分享链接下的文件列表

Parameters:
  • client – 115 客户端或 cookies

  • share_code – 分享码或链接

  • receive_code – 接收码

  • cid – 顶层目录的 id,从此开始遍历

  • id_to_dirnode – 字典,保存 id 到对应文件的 (name, parent_id) 元组的字典,如果为 …,则忽略

  • app – 使用指定 app(设备)的接口

  • async – 是否异步

  • request_kwargs – 其它请求参数

Returns:

迭代器,返回此分享链接下的(所有文件)文件信息,由于接口返回信息有限,所以比较简略

{
    "id": int,
    "sha1": str,
    "name": str,
    "size": int,
    "path": str,
}

p115client.tool.iterdir.share_iterdir(client: None | str | PathLike | P115Client, share_code: str, receive_code: str = '', cid: int | Mapping = 0, page_size: int = 0, start: int = 0, order: Literal['file_name', 'file_size', 'user_ptime'] = 'user_ptime', asc: Literal[0, 1] = 1, normalize_attr: None | Callable[[dict], dict] = normalize_attr, id_to_dirnode: None | EllipsisType | MutableMapping[int, tuple[str, int]] = None, app: str = 'web', cooldown: None | float = None, max_workers: None | int = 0, *, async_: Literal[False] = False, **request_kwargs) Iterator[dict][source]
p115client.tool.iterdir.share_iterdir(client: None | str | PathLike | P115Client, share_code: str, receive_code: str = '', cid: int | Mapping = 0, page_size: int = 0, start: int = 0, order: Literal['file_name', 'file_size', 'user_ptime'] = 'user_ptime', asc: Literal[0, 1] = 1, normalize_attr: None | Callable[[dict], dict] = normalize_attr, id_to_dirnode: None | EllipsisType | MutableMapping[int, tuple[str, int]] = None, app: str = 'web', cooldown: None | float = None, max_workers: None | int = 0, *, async_: Literal[True], **request_kwargs) AsyncIterator[dict]

对分享链接迭代目录,获取文件信息

Note

app=”web”`(默认),则 `client 可以传 None,即可以不登录获取数据

Parameters:
  • client – 115 客户端或 cookies

  • share_code – 分享码或链接

  • receive_code – 接收码

  • cid – 目录的 id

  • page_size – 分页大小

  • start – 开始索引,从 0 开始

  • order

    排序

    • ”file_name”: 文件名

    • ”file_size”: 文件大小

    • ”file_type”: 文件种类

    • ”user_utime”: 修改时间

    • ”user_ptime”: 创建时间

    • ”user_otime”: 上一次打开时间

  • asc – 升序排列。0: 否,1: 是

  • normalize_attr – 把数据进行转换处理,使之便于阅读

  • id_to_dirnode – 字典,保存 id 到对应文件的 (name, parent_id) 元组的字典

  • app – 使用指定 app(设备)的接口

  • cooldown – 冷却时间,单位为秒。如果为 None,则用默认值(非并发时为 0,并发时为 1)

  • max_workers – 最大并发数,如果为 None 或 < 0 则自动确定,如果为 0 则单工作者惰性执行

  • async – 是否异步

  • request_kwargs – 其它请求参数

Returns:

迭代器,返回此目录内的文件信息(文件和目录)

p115client.tool.iterdir.share_iterdir_traverse(client: None | str | PathLike | P115Client, share_code: str, receive_code: str = '', cid: int | Mapping = 0, topdown: None | bool = True, min_depth: int = 1, max_depth: int = -1, predicate: None | bool | Callable[[dict], Any] = None, onerror: bool | Callable[[OSError], Any] = False, normalize_attr: Callable[[dict], dict] = normalize_attr, id_to_dirnode: None | EllipsisType | MutableMapping[int, tuple[str, int]] = None, app: str = 'web', cooldown: None | float = None, *, async_: Literal[False] = False, **request_kwargs) Iterator[dict][source]
p115client.tool.iterdir.share_iterdir_traverse(client: None | str | PathLike | P115Client, share_code: str, receive_code: str = '', cid: int | Mapping = 0, topdown: None | bool = True, min_depth: int = 1, max_depth: int = -1, predicate: None | bool | Callable[[dict], Any] = None, onerror: bool | Callable[[OSError], Any] = False, normalize_attr: Callable[[dict], dict] = normalize_attr, id_to_dirnode: None | EllipsisType | MutableMapping[int, tuple[str, int]] = None, app: str = 'web', cooldown: None | float = None, *, async_: Literal[True], **request_kwargs) AsyncIterator[dict]

迭代目录树,获取文件信息

Attention

这个函数不支持并发,而且是对罗列目录接口的循环调用,所以速度会比较慢,而且也容易被风控(可以设置 cooldown 以限制接口调用频率)

Note

app=”web”`(默认),则 `client 可以传 None,即可以不登录获取数据

Parameters:
  • client – 115 客户端或 cookies

  • share_code – 分享码或链接

  • receive_code – 接收码

  • cid – 目录的 id

  • topdown – 如果是 True,自顶向下深度优先搜索;如果是 False,自底向上深度优先搜索;如果是 None,广度优先搜索

  • min_depth – 最小深度,top 本身为 0

  • max_depth – 最大深度,< 0 时不限

  • predicate

    调用以筛选遍历得到的路径

    • 如果为 None,则不做筛选

    • 如果为 True,则只输出文件

    • 如果为 False,则只输出目录

    • 否则,就是 Callable。对于返回值
      • 如果为 True,则输出它,且会继续搜索它的子树

      • 如果为 False,则跳过它,但会继续搜索它的子树

      • 如果为 1,则输出它,但跳过它的子树

      • 如果为 0,则跳过它,且跳过它的子树

  • onerror – 处理 OSError 异常。如果是 True,抛出异常;如果是 False,忽略异常;如果是调用,以异常为参数调用之

  • normalize_attr – 把数据进行转换处理,使之便于阅读

  • id_to_dirnode – 字典,保存 id 到对应文件的 (name, parent_id) 元组的字典

  • app – 使用指定 app(设备)的接口

  • cooldown – 冷却时间,单位为秒。如果为 None,则用默认值(非并发时为 0,并发时为 1)

  • async – 是否异步

  • request_kwargs – 其它请求参数

Returns:

迭代器,返回此目录内的文件信息(文件和目录)

p115client.tool.iterdir.share_iterdir_walk(client: None | str | PathLike | P115Client, share_code: str, receive_code: str = '', cid: int | Mapping = 0, topdown: None | bool = True, min_depth: int = 1, max_depth: int = -1, onerror: bool | Callable[[OSError], Any] = False, normalize_attr: Callable[[dict], dict] = normalize_attr, id_to_dirnode: None | EllipsisType | MutableMapping[int, tuple[str, int]] = None, app: str = 'web', cooldown: None | float = None, *, async_: Literal[False] = False, **request_kwargs) Iterator[tuple[int, list[dict], list[dict]]][source]
p115client.tool.iterdir.share_iterdir_walk(client: None | str | PathLike | P115Client, share_code: str, receive_code: str = '', cid: int | Mapping = 0, topdown: None | bool = True, min_depth: int = 1, max_depth: int = -1, onerror: bool | Callable[[OSError], Any] = False, normalize_attr: Callable[[dict], dict] = normalize_attr, id_to_dirnode: None | EllipsisType | MutableMapping[int, tuple[str, int]] = None, app: str = 'web', cooldown: None | float = None, *, async_: Literal[True], **request_kwargs) AsyncIterator[tuple[int, list[dict], list[dict]]]

迭代目录树,获取文件信息

Attention

这个函数不支持并发,而且是对罗列目录接口的循环调用,所以速度会比较慢,而且也容易被风控(可以设置 cooldown 以限制接口调用频率)

Note

app=”web”`(默认),则 `client 可以传 None,即可以不登录获取数据

Parameters:
  • client – 115 客户端或 cookies

  • share_code – 分享码或链接

  • receive_code – 接收码

  • cid – 目录的 id

  • topdown – 如果是 True,自顶向下深度优先搜索;如果是 False,自底向上深度优先搜索;如果是 None,广度优先搜索

  • min_depth – 最小深度,top 本身为 0

  • max_depth – 最大深度,< 0 时不限

  • onerror – 处理 OSError 异常。如果是 True,抛出异常;如果是 False,忽略异常;如果是调用,以异常为参数调用之

  • normalize_attr – 把数据进行转换处理,使之便于阅读

  • id_to_dirnode – 字典,保存 id 到对应文件的 (name, parent_id) 元组的字典

  • app – 使用指定 app(设备)的接口

  • cooldown – 冷却时间,单位为秒。如果为 None,则用默认值(非并发时为 0,并发时为 1)

  • async – 是否异步

  • request_kwargs – 其它请求参数

Returns:

迭代器,产生 (pid, 目录信息列表, 文件信息列表) 元组

p115client.tool.iterdir.share_search_iter(client: str | PathLike | P115Client, share_code: str, receive_code: str = '', search_value: str = '.', cid: int | Mapping = 0, suffix: str = '', type: int = 99, offset: int = 0, page_size: int = 115, normalize_attr: None | Callable[[dict], dict] = normalize_attr, *, async_: Literal[False] = False, **request_kwargs) Iterator[dict][source]
p115client.tool.iterdir.share_search_iter(client: str | PathLike | P115Client, share_code: str, receive_code: str = '', search_value: str = '.', cid: int | Mapping = 0, suffix: str = '', type: int = 99, offset: int = 0, page_size: int = 115, normalize_attr: None | Callable[[dict], dict] = normalize_attr, *, async_: Literal[True], **request_kwargs) AsyncIterator[dict]

在分享链接下搜索然后迭代返回结果

Parameters:
  • client – 115 客户端或 cookies

  • share_code – 分享码或链接

  • receive_code – 接收码

  • search_value – 搜索关键词,搜索到的文件名必须包含这个字符串

  • cid – 目录 id

  • suffix – 后缀名(优先级高于 type)

  • type

    文件类型

    • 1: 文档

    • 2: 图片

    • 3: 音频

    • 4: 视频

    • 5: 压缩包

    • 6: 应用

    • 7: 书籍

    • 99: 所有文件

  • offset – 开始索引,从 0 开始,要求 <= 10,000

  • page_size – 分页大小,要求 offset + page_size <= 10,000

  • normalize_attr – 把数据进行转换处理,使之便于阅读

  • async – 是否异步

  • request_kwargs – 其它请求参数

Returns:

返回文件信息,如果没有,则是 None

p115client.tool.iterdir.traverse_tree(client: str | PathLike | P115Client, cid: int | str | Mapping = 0, id_to_dirnode: None | EllipsisType | MutableMapping[int, tuple[str, int]] = None, app: str = 'android', max_workers: None | int = None, max_files: int | None = 0, max_dirs: int | None = 0, *, async_: Literal[False] = False, **request_kwargs) Iterator[dict][source]
p115client.tool.iterdir.traverse_tree(client: str | PathLike | P115Client, cid: int | str | Mapping = 0, id_to_dirnode: None | EllipsisType | MutableMapping[int, tuple[str, int]] = None, app: str = 'android', max_workers: None | int = None, max_files: int | None = 0, max_dirs: int | None = 0, *, async_: Literal[True], **request_kwargs) AsyncIterator[dict]

遍历目录树,获取文件或目录节点的信息

Parameters:
  • client – 115 客户端或 cookies

  • cid – 目录 id 或 pickcode

  • id_to_dirnode – 字典,保存 id 到对应文件的 (name, parent_id) 元组的字典

  • app – 使用指定 app(设备)的接口

  • max_workers – 最大并发数,如果为 None 或 < 0 则自动确定,如果为 0 则单工作者惰性执行

  • max_files – 估计最大存在的文件数,<= 0 时则无限

  • max_dirs – 估计最大存在的目录数,<= 0 时则无限

  • async – 是否异步

  • request_kwargs – 其它请求参数

Returns:

迭代器,返回此目录内的文件或目录节点的信息

p115client.tool.iterdir.traverse_tree_with_path(client: str | PathLike | P115Client, cid: int | str | Mapping = 0, with_ancestors: bool = False, escape: None | bool | Callable[[str], str] = True, id_to_dirnode: None | EllipsisType | MutableMapping[int, tuple[str, int]] = None, app: str = 'android', max_workers: None | int = None, max_files: int | None = 0, max_dirs: int | None = 0, *, async_: Literal[False] = False, **request_kwargs) Iterator[dict][source]
p115client.tool.iterdir.traverse_tree_with_path(client: str | PathLike | P115Client, cid: int | str | Mapping = 0, with_ancestors: bool = False, escape: None | bool | Callable[[str], str] = True, id_to_dirnode: None | EllipsisType | MutableMapping[int, tuple[str, int]] = None, app: str = 'android', max_workers: None | int = None, max_files: int | None = 0, max_dirs: int | None = 0, *, async_: Literal[True], **request_kwargs) AsyncIterator[dict]

遍历目录树,获取文件或目录节点的信息(包含 “path”,可选 “ancestors”)

Parameters:
  • client – 115 客户端或 cookies

  • cid – 目录 id 或 pickcode

  • with_ancestors – 文件信息中是否要包含 “ancestors”

  • escape

    对文件名进行转义

    • 如果为 None,则不处理;否则,这个函数用来对文件名中某些符号进行转义,例如 “/” 等

    • 如果为 True,则使用 posixpatht.escape,会对文件名中 “/”,或单独出现的 “.” 和 “..” 用 “" 进行转义

    • 如果为 False,则使用 posix_escape_name 函数对名字进行转义,会把文件名中的 “/” 转换为 “|”

    • 如果为 Callable,则用你所提供的调用,以或者转义后的名字

  • id_to_dirnode – 字典,保存 id 到对应文件的 (name, parent_id) 元组的字典

  • app – 使用指定 app(设备)的接口

  • max_workers – 最大并发数,如果为 None 或 < 0 则自动确定,如果为 0 则单工作者惰性执行

  • max_files – 估计最大存在的文件数,<= 0 时则无限

  • max_dirs – 估计最大存在的目录数,<= 0 时则无限

  • async – 是否异步

  • request_kwargs – 其它请求参数

Returns:

迭代器,返回此目录内的文件或目录节点的信息