MCPcopy Index your code
hub / github.com/KnowledgeXLab/LeanRAG / write_chunk

Function write_chunk

tools/io_file.py:413–424  ·  view source on GitHub ↗

写入文本文件的某一块。 参数: - file_path (str): 文件路径。 - chunk (str): 要写入的文本块。 - mode (str): 写入模式,默认为 'a'(追加模式),可以选择 'w'(覆盖模式)。 - encoding (str): 写入文件的编码格式,默认为 'utf-8'。

(file_path, chunk, mode, encoding='utf-8')

Source from the content-addressed store, hash-verified

411
412
413def write_chunk(file_path, chunk, mode, encoding='utf-8'):
414 """
415 写入文本文件的某一块。
416
417 参数:
418 - file_path (str): 文件路径。
419 - chunk (str): 要写入的文本块。
420 - mode (str): 写入模式,默认为 'a'(追加模式),可以选择 'w'(覆盖模式)。
421 - encoding (str): 写入文件的编码格式,默认为 'utf-8'
422 """
423 with open(file_path, mode, encoding=encoding) as f:
424 f.write(chunk)
425
426
427def write_jsonl(file_path, data, mode, chunk_size, encoding='utf-8'):

Callers

nothing calls this directly

Calls 1

writeMethod · 0.80

Tested by

no test coverage detected