如何在后台的ElectronJS应用中解析大型.xls文件?

时间:2018-10-06 22:01:51

标签: javascript node.js electron

我正在尝试一个基本的ElectronJS应用,其中我正在尝试从本地文件系统读取.xls文件并尝试对其进行解析:

Started POST "/occasions" for 127.0.0.1 at 2018-10-06 14:59:05 -0700

Processing by OccasionsController#create as HTML
  Parameters: {"utf8"=>"✓", "authenticity_token"=>"utl5aK6RoJRxGKUsYbrz6tHs4uWzWMROXBMRJaxSqLd00CMHcBZ1L9WondisYvtWYJ2tw4X4QxMKAXSFurPV6g==", "occasion"=>{"name"=>"Test Occasion", "date"=>"2018-12-25", "notes"=>"This is a test.  It should have 3 people associated with this occasion.", "people"=>["", "22", "24", "25"]}, "commit"=>"Create Occasion"}
  User Load (0.3ms)  SELECT  "users".* FROM "users" WHERE "users"."id" = ? ORDER BY "users"."id" ASC LIMIT ?  [["id", 1], ["LIMIT", 1]]
  ↳ /Users/lizbayardelle/.rvm/gems/ruby-2.5.0/gems/activerecord-5.2.1/lib/active_record/log_subscriber.rb:98

Unpermitted parameter: :people
   (0.1ms)  begin transaction
  ↳ app/controllers/occasions_controller.rb:34
  User Load (0.3ms)  SELECT  "users".* FROM "users" WHERE "users"."id" = ? LIMIT ?  [["id", 1], ["LIMIT", 1]]
  ↳ app/controllers/occasions_controller.rb:34
  Occasion Create (0.6ms)  INSERT INTO "occasions" ("user_id", "name", "date", "notes", "created_at", "updated_at") VALUES (?, ?, ?, ?, ?, ?)  [["user_id", 1], ["name", "Test Occasion"], ["date", "2018-12-25"], ["notes", "This is a test.  It should have 3 people associated with this occasion."], ["created_at", "2018-10-06 21:59:05.931738"], ["updated_at", "2018-10-06 21:59:05.931738"]]
  ↳ app/controllers/occasions_controller.rb:34
   (1.6ms)  commit transaction
  ↳ app/controllers/occasions_controller.rb:34

Redirected to http://localhost:3000/occasions

Completed 302 Found in 10ms (ActiveRecord: 2.9ms)

该文件大约有300,000行,并且代码能够解析和登记所有行中的数据。但是,直到解析文件之前,应用程序GUI均无响应。如何使此代码在后台运行而不会出现此问题?

0 个答案:

没有答案