Skip to content
Next Next commit
Fixup File API
  • Loading branch information
zetashift committed Aug 22, 2022
commit 1604459234253b784f8dc976e4b8a7bcbbac4584
22 changes: 21 additions & 1 deletion dom/src/main/scala/org/scalajs/dom/File.scala
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,28 @@ import scala.scalajs.js.annotation._
*/
@js.native
@JSGlobal
abstract class File extends Blob {
abstract class File[A](bits: js.Iterable[A], name: String, options: FileOptions) extends Blob {

/** Returns the name of the file. For security reasons, the path is excluded from this property. */
def name: String = js.native

/** The File.lastModified read-only property provides the last modified date of the file as the number of milliseconds
* since the Unix epoch (January 1, 1970 at midnight). Files without a known last modified date return the current
* date.
*/
def lastModified: Int = js.native

/** The File.webkitRelativePath is a read-only property that contains a string which specifies the file's path
* relative to the directory selected by the user in an <input> element with its webkitdirectory attribute set.
*
* @return
* A string containing the path of the file relative to the ancestor directory the user selected.
*/
def webkitRelativePath: String = js.native
}

/** An options object containing optional attributes for the file. */
trait FileOptions extends js.Object {
var `type`: js.UndefOr[String] = js.undefined
var lastModified: js.UndefOr[Int] = js.undefined
}