How to use 'js import file' in JavaScript

Every line of 'js import file' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
this disclaimer
207function importFile2() {
208 let input_files = d3.select("#ImportfileInput").node().files;
209 let merge = d3.select("#mergeCheckBox").property("checked");
210 let oldFormat = d3.select("#OldFormatCheckBox").property("checked");
211 // let top_graph = d3.select("#graphPathInput").property("value");
212 // if (top_graph === "" && !oldFormat) { alert("the new hierarchy position is empty"); return 0; }
213 if (input_files.length > 0) {
214 let file = input_files[0];
215 let ka = new FileReader();
216 ka.onloadend = function (e) {
217 if (oldFormat) {
218 converter.kamiToRegraph(e.target.result, dispatch, "Graph");
219 }
220 else {
221 d3.json(e.target.result, function (rep) {
222 if (merge) {
223 request.mergeHierarchy2(
224 //top_graph,
225 "/",
226 JSON.stringify(rep, null, "\t"),
227 afterImport);
228 }
229 else {
230 request.mergeHierarchy(
231 "/",
232 // top_graph,
233 JSON.stringify(rep, null, "\t"),
234 afterImport);
235 // request.addHierarchy(
236 // top_graph,
237 // JSON.stringify(rep, null, "\t"),
238 // afterImport);
239 }
240
241 })
242 }
243 };
244 ka.readAsDataURL(file);
245 }
246
247}
Important

Use secure code every time

Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code

70function _load_import() {
71 return _import = _interopRequireWildcard(require('./import.js'));
72}

Related snippets