mirror of
https://github.com/unidoc/unioffice.git
synced 2025-04-29 13:49:10 +08:00
32 lines
1.5 KiB
Go
32 lines
1.5 KiB
Go
//
|
|
// Copyright 2020 FoxyUtils ehf. All rights reserved.
|
|
//
|
|
// This is a commercial product and requires a license to operate.
|
|
// A trial license can be obtained at https://unidoc.io
|
|
//
|
|
// DO NOT EDIT: generated by unitwist Go source code obfuscator.
|
|
//
|
|
// Use of this source code is governed by the UniDoc End User License Agreement
|
|
// terms that can be accessed at https://unidoc.io/eula/
|
|
|
|
// Package diskstore implements tempStorage interface
|
|
// by using disk as a storage
|
|
package diskstore ;import (_bd "github.com/unidoc/unioffice/common/tempstorage";_g "io/ioutil";_ed "os";_e "strings";);
|
|
|
|
// Open opens file from disk according to a path
|
|
func (_c diskStorage )Open (path string )(_bd .File ,error ){return _ed .OpenFile (path ,_ed .O_RDWR ,0644);};
|
|
|
|
// Add is not applicable in the diskstore implementation
|
|
func (_cg diskStorage )Add (path string )error {return nil };
|
|
|
|
// SetAsStorage sets temp storage as a disk storage
|
|
func SetAsStorage (){_ga :=diskStorage {};_bd .SetAsStorage (&_ga )};type diskStorage struct{};
|
|
|
|
// TempFile creates a new temp file by calling ioutil TempFile
|
|
func (_gg diskStorage )TempFile (dir ,pattern string )(_bd .File ,error ){return _g .TempFile (dir ,pattern );};
|
|
|
|
// TempFile creates a new temp directory by calling ioutil TempDir
|
|
func (_eg diskStorage )TempDir (pattern string )(string ,error ){return _g .TempDir ("",pattern )};
|
|
|
|
// RemoveAll removes all files in the directory
|
|
func (_d diskStorage )RemoveAll (dir string )error {if _e .HasPrefix (dir ,_ed .TempDir ()){return _ed .RemoveAll (dir );};return nil ;}; |