wwf

package
v0.0.0-...-0fb43f7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 3, 2022 License: AGPL-3.0 Imports: 7 Imported by: 0

README

wwf - working with files 📃

Package for working with files

import to progect:
import "github.com/nik19ta/go_server/api/wwf"
Funcs:
  • RecordFile(fileName) return File - Creates a new instance of the File struct, with an empty Data
  • CreateFile(name string) return true or false - create new file
use stract File:
type File struct {
	Name        string
	IsDirectory bool
	Data        string
	Size        int64
	ModTime     time.Time
}
File methods
  • Write(newFill) return File.Data - Writes new content to a file
  • Rename(newName) return true or false - Rename file
  • Open() - Replaces the empty File.Data on the file contents
  • Delete() -> true or false - Delete file
  • Send() return []byte, bool - returns a struct converted to Json

Documentation

Overview

Package wwf - Work With Files

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type File

type File struct {
	Name        string
	IsDirectory bool
	Data        string
	Size        int64
	ModTime     time.Time
}

File - Структура Файлов, Data поумолчанию должна быть пустой

func CreateFile

func CreateFile(name string) (bool, File)

CreateFile - создает новый файл <-- принимает имя файла --> возвращает File, true в случае создания, false в случае неудачи

func RecordFile

func RecordFile(fileName string) (File, bool)

RecordFile - Создает новый экземпляр Структуры File, с пустой Data

func (*File) Delete

func (f *File) Delete() bool

Delete - удаляет файл --> возвращает true в случае удаления, false в случае неудачи

func (*File) Open

func (f *File) Open()

Open - Заменяет путстую File.Data на содержимое файла c пробелами и переносами строк

func (*File) Rename

func (f *File) Rename(newName string) bool

Rename - Меняет имя файла <-- принимает полное, новое имя файла --> возвращает true в случае успешной смены имени, false в случае неудачи

func (*File) Send

func (f *File) Send() ([]byte, bool)

Send - --> возвращает структуру преобразованную в Json

func (*File) Write

func (f *File) Write(newFill string) string

Write - перезаписывает содержимое файла, File.Data --> отдает его содержимое

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL