MCPcopy Create free account
hub / github.com/emscripten-core/emscripten / write_file

Function write_file

tools/utils.py:181–188  ·  view source on GitHub ↗

Write to a file opened in text mode.

(file_path, text, line_endings=None)

Source from the content-addressed store, hash-verified

179
180
181def write_file(file_path, text, line_endings=None):
182 """Write to a file opened in text mode."""
183 if line_endings and line_endings != os.linesep:
184 text = text.replace('\n', line_endings)
185 write_binary(file_path, text.encode('utf-8'))
186 else:
187 with open(file_path, 'w', encoding='utf-8') as fh:
188 fh.write(text)
189
190
191def write_binary(file_path, contents):

Callers 15

test_binary_encodeMethod · 0.90
test_dead_code_esmMethod · 0.90
verify_in_strict_modeMethod · 0.90
test_int53Method · 0.90
test_binary_encodeMethod · 0.90
run_benchmarkFunction · 0.90
phase_post_linkFunction · 0.70
phase_emit_tsdFunction · 0.70
phase_embind_aotFunction · 0.70
fix_js_manglingFunction · 0.70
create_esm_wrapperFunction · 0.70

Calls 4

write_binaryFunction · 0.85
encodeMethod · 0.80
openFunction · 0.50
writeMethod · 0.45

Tested by 6

test_binary_encodeMethod · 0.72
test_dead_code_esmMethod · 0.72
verify_in_strict_modeMethod · 0.72
test_int53Method · 0.72
test_binary_encodeMethod · 0.72