<commit_before>// ----- Requires ----- //

var fs = require('fs');


// ----- Export ----- //

module.exports = function File (window, editor) {

	// ----- Internal Properties ----- //

	var document = window.document;
	var fileOpen = document.getElementById('file_open');
	var fileSave = document.getElementById('file_save');
	var filepath = null;


	// ----- Functions ----- //

	// Reads a file and puts its content into the editor area.
	function open () {

		var filepath = fileOpen.value;
		fileOpen.files.clear();

		fs.readFile(filepath, function (err, data) {
			editor.setContent(data);
		});

	}

	// Saves the contents of the editor area to user-specified location.
	function saveAs () {

		filepath = fileSave.value;
		fileSave.files.clear();

		save();

	}

	// Saves editor contents to disk.<commit_msg>Opening a file preloads the filepath, bypassing the save as dialog on first save.<commit_after>// ----- Requires ----- //

var fs = require('fs');


// ----- Export ----- //

module.exports = function File (window, editor) {

	// ----- Internal Properties ----- //

	var document = window.document;
	var fileOpen = document.getElementById('file_open');
	var fileSave = document.getElementById('file_save');
	var filepath = null;


	// ----- Functions ----- //

	// Reads a file and puts its content into the editor area.
	function open () {

		var openPath = fileOpen.value;
		filepath = openPath;

		fileOpen.files.clear();

		fs.readFile(openPath, function (err, data) {
			editor.setContent(data);
		});

	}

	// Saves the contents of the editor area to user-specified location.
	function saveAs () {

		filepath = fileSave.value;
		fileSave.files.clear();

		save();

	}

	// Saves editor contents to disk.
{'fraction_non_alphanumeric': 0.16550925925925927, 'fraction_numerical': 0.0, 'mean_word_length': 2.6247379454926625, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '555445', 'n_tokens_mistral': 557, 'n_tokens_neox': 502, 'n_words': 152}